cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1204665 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
Date Mon, 21 Nov 2011 19:43:33 GMT
Author: dkulp
Date: Mon Nov 21 19:43:33 2011
New Revision: 1204665

URL: http://svn.apache.org/viewvc?rev=1204665&view=rev
Log:
Check a message property for the token if caching on the endpoint is
turned off.  Avoid a synchronized block if the TokenStore is available.

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java?rev=1204665&r1=1204664&r2=1204665&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/IssuedTokenInterceptorProvider.java
Mon Nov 21 19:43:33 2011
@@ -89,8 +89,7 @@ public class IssuedTokenInterceptorProvi
         this.getInFaultInterceptors().add(new IssuedTokenInInterceptor());
     }
     
-    
-    static final TokenStore getTokenStore(Message message) {
+    static final TokenStore createTokenStore(Message message) {
         EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
         synchronized (info) {
             TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
@@ -101,8 +100,15 @@ public class IssuedTokenInterceptorProvi
                 tokenStore = new MemoryTokenStore();
                 info.setProperty(TokenStore.class.getName(), tokenStore);
             }
-            return tokenStore;
+            return tokenStore; 
+        }
+    }
+    static final TokenStore getTokenStore(Message message) {
+        TokenStore tokenStore = (TokenStore)message.getContextualProperty(TokenStore.class.getName());
+        if (tokenStore == null) {
+            tokenStore = createTokenStore(message);
         }
+        return tokenStore;
     }
 
     static class IssuedTokenOutInterceptor extends AbstractPhaseInterceptor<Message>
{
@@ -247,6 +253,14 @@ public class IssuedTokenInterceptorProvi
                         tok = getTokenStore(message).getToken(tokId);
                     }
                 }
+            } else {
+                tok = (SecurityToken)message.get(SecurityConstants.TOKEN);
+                if (tok == null) {
+                    String tokId = (String)message.get(SecurityConstants.TOKEN_ID);
+                    if (tokId != null) {
+                        tok = getTokenStore(message).getToken(tokId);
+                    }
+                }
             }
             return tok;
         }



Mime
View raw message