cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/3] cxf git commit: Look in the message properties for jwt tokens as well
Date Wed, 14 Oct 2015 11:45:43 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f6c56d931 -> 5778d255d


Look in the message properties for jwt tokens as well


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/80f2e9ff
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/80f2e9ff
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/80f2e9ff

Branch: refs/heads/master
Commit: 80f2e9ffa7825e477f6fe1ea47898e896b03c79d
Parents: f6c56d9
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Oct 14 10:33:35 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Oct 14 10:33:35 2015 +0100

----------------------------------------------------------------------
 .../jose/jaxrs/JwtAuthenticationClientFilter.java        | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/80f2e9ff/rt/rs/security/jose/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwtAuthenticationClientFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwtAuthenticationClientFilter.java
b/rt/rs/security/jose/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwtAuthenticationClientFilter.java
index 126f64e..3a79b84 100644
--- a/rt/rs/security/jose/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwtAuthenticationClientFilter.java
+++ b/rt/rs/security/jose/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwtAuthenticationClientFilter.java
@@ -29,6 +29,8 @@ import javax.ws.rs.core.HttpHeaders;
 import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.rs.security.jose.common.JoseException;
 import org.apache.cxf.rs.security.jose.common.JoseUtils;
 import org.apache.cxf.rs.security.jose.jwe.JweHeaders;
@@ -68,7 +70,14 @@ public class JwtAuthenticationClientFilter extends AbstractJoseJwtProducer
                                               authScheme + " " + data);
     }
     protected JwtToken getJwtToken(ClientRequestContext requestContext) {
-        return (JwtToken)requestContext.getProperty(JwtConstants.JWT_TOKEN);
+        // Try the filter properties first, then the message properties
+        JwtToken token = (JwtToken)requestContext.getProperty(JwtConstants.JWT_TOKEN);
+        if (token != null) {
+            return token;
+        }
+        
+        Message m = PhaseInterceptorChain.getCurrentMessage();
+        return (JwtToken)m.getContextualProperty(JwtConstants.JWT_TOKEN);
     }
     protected String getContextPropertyValue() {
         return Base64UrlUtility.encode(CryptoUtils.generateSecureRandomBytes(16));


Mime
View raw message