cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1389800 - /cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Date Tue, 25 Sep 2012 11:10:24 GMT
Author: coheigea
Date: Tue Sep 25 11:10:24 2012
New Revision: 1389800

URL: http://svn.apache.org/viewvc?rev=1389800&view=rev
Log:
Merged revisions 1389794 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1389794 | coheigea | 2012-09-25 12:04:17 +0100 (Tue, 25 Sep 2012) | 10 lines

  Merged revisions 1389788 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1389788 | coheigea | 2012-09-25 11:52:36 +0100 (Tue, 25 Sep 2012) | 2 lines

    Updating WSS4JInInterceptor to use LoginSecurityContext

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java

Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1389800&r1=1389799&r2=1389800&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Tue Sep 25 11:10:24 2012
@@ -24,13 +24,16 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 
 
+import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -52,12 +55,14 @@ import org.apache.cxf.binding.soap.saaj.
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.security.SimplePrincipal;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.security.LoginSecurityContext;
 import org.apache.cxf.security.SecurityContext;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -532,8 +537,18 @@ public class WSS4JInInterceptor extends 
         return createSecurityContext(p, null);
     }
     
-    protected SecurityContext createSecurityContext(final Principal p, final List<String>
roles) {
-        return new SecurityContext() {
+    protected LoginSecurityContext createSecurityContext(final Principal p, final List<String>
roles) {
+        final Set<Principal> userRoles;
+        if (roles != null) {
+            userRoles = new HashSet<Principal>();
+            for (String role : roles) {
+                userRoles.add(new SimplePrincipal(role));
+            }
+        } else {
+            userRoles = null;
+        }
+        
+        return new LoginSecurityContext() {
             public Principal getUserPrincipal() {
                 return p;
             }
@@ -543,6 +558,12 @@ public class WSS4JInInterceptor extends 
                 }
                 return roles.contains(role);
             }
+            public Subject getSubject() {
+                return null;
+            }
+            public Set<Principal> getUserRoles() {
+                return userRoles;
+            }
         };
     }
     



Mime
View raw message