cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf git commit: Support none signature for JWT tokens
Date Thu, 05 Nov 2015 16:29:45 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes ef2ec7bba -> 346decc52


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

Branch: refs/heads/3.0.x-fixes
Commit: 4d5738c40f690ecad2280ff22e86a29105aa6626
Parents: ef2ec7b
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:29: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/4d5738c4/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 a79d124..1b062b3 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
@@ -302,16 +302,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