cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Only initialise the encryption provider if it is actually needed
Date Thu, 08 Oct 2015 16:25:59 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 572a11cf2 -> 6e0e97278


Only initialise the encryption provider if it is actually needed


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

Branch: refs/heads/master
Commit: 6e0e97278be6dfb3dea4f9300929de0303968c7c
Parents: 572a11c
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Oct 8 17:00:05 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Oct 8 17:22:22 2015 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6e0e9727/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java
index 95dc586..cb7d394 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJoseJwtProducer.java
@@ -39,12 +39,14 @@ public abstract class AbstractJoseJwtProducer extends AbstractJoseProducer
{
             throw new JwtException("Unable to secure JWT");
         }
         String data = null;
-        if (theEncProvider == null) {
+        
+        if (isJweRequired() && theEncProvider == null) {
             theEncProvider = getInitializedEncryptionProvider();
+            if (theEncProvider == null) {
+                throw new JwtException("Unable to encrypt JWT");
+            }
         }
-        if (theEncProvider == null && isJweRequired()) {
-            throw new JwtException("Unable to encrypt JWT");
-        }
+        
         if (isJwsRequired()) {
             if (theSigProvider == null) {
                 theSigProvider = getInitializedSignatureProvider();


Mime
View raw message