cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/4] cxf git commit: Look in the message properties for jwt tokens as well
Date Wed, 14 Oct 2015 11:46:19 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 998c6aedb -> 02f4a46b0


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/66acc5e5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/66acc5e5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/66acc5e5

Branch: refs/heads/3.0.x-fixes
Commit: 66acc5e51a9736aa3672793c1b5e515df2c5c9a0
Parents: 998c6ae
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 12:46:10 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/66acc5e5/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 43be31e..72b53ef 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
@@ -30,6 +30,8 @@ import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Endpoint;
 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;
@@ -69,7 +71,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