cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf git commit: Support none signature for JWT tokens
Date Thu, 05 Nov 2015 16:27:48 GMT
Support none signature for JWT tokens


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

Branch: refs/heads/master
Commit: 5dd07f5b39baa2d81d44b4b5e3b74a49aec12e93
Parents: 308f4dc
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Nov 5 15:56:09 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Nov 5 16:27:34 2015 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/jose/jws/JwsUtils.java      | 24 ++++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5dd07f5b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
index 3a9a91e..fcebd84 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
@@ -301,16 +301,20 @@ public final class JwsUtils {
             }
         } else {
             String signatureAlgo = getSignatureAlgo(m, props, null, null);
-            PrivateKey pk = KeyManagementUtils.loadPrivateKey(m, props, KeyOperation.SIGN);
-            theSigProvider = getPrivateKeySignatureProvider(pk, 
-                                                            SignatureAlgorithm.getAlgorithm(signatureAlgo));
-            if (includeCert) {
-                headers.setX509Chain(KeyManagementUtils.loadAndEncodeX509CertificateOrChain(m,
props));
-            }
-            if (includeCertSha1) {
-                String digest = KeyManagementUtils.loadDigestAndEncodeX509Certificate(m,
props);
-                if (digest != null) {
-                    headers.setX509Thumbprint(digest);
+            if (SignatureAlgorithm.getAlgorithm(signatureAlgo) == SignatureAlgorithm.NONE)
{
+                theSigProvider = new NoneJwsSignatureProvider();
+            } else {
+                PrivateKey pk = KeyManagementUtils.loadPrivateKey(m, props, KeyOperation.SIGN);
+                theSigProvider = getPrivateKeySignatureProvider(pk, 
+                                                                SignatureAlgorithm.getAlgorithm(signatureAlgo));
+                if (includeCert) {
+                    headers.setX509Chain(KeyManagementUtils.loadAndEncodeX509CertificateOrChain(m,
props));
+                }
+                if (includeCertSha1) {
+                    String digest = KeyManagementUtils.loadDigestAndEncodeX509Certificate(m,
props);
+                    if (digest != null) {
+                        headers.setX509Thumbprint(digest);
+                    }
                 }
             }
         }


Mime
View raw message