cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] git commit: CXF-5944 Minor updates to JWSCompactConsumer and Producer
Date Thu, 25 Sep 2014 11:30:39 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f49d0a3b4 -> eae0b0362


CXF-5944 Minor updates to JWSCompactConsumer and Producer


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

Branch: refs/heads/master
Commit: 5ef794b0204524f28f8a5557b27b5cdd7311928d
Parents: e4befc7
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Sep 25 12:29:21 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Sep 25 12:29:21 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java | 4 ++++
 .../org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java | 5 +++++
 .../main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java | 3 +++
 3 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5ef794b0/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
index 422473f..8c963ec 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
@@ -21,6 +21,7 @@ package org.apache.cxf.rs.security.jose.jws;
 import java.io.UnsupportedEncodingException;
 
 import org.apache.cxf.common.util.Base64Exception;
+import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 import org.apache.cxf.rs.security.jose.jwt.JwtHeadersReader;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenReader;
@@ -96,6 +97,9 @@ public class JwsCompactConsumer {
         }
         return true;
     }
+    public boolean verifySignatureWith(JsonWebKey key) {
+        return verifySignatureWith(JwsUtils.getSignatureVerifier(key));
+    }
     private void enforceJweSignatureProperties() {
         if (props != null) {
             //TODO:

http://git-wip-us.apache.org/repos/asf/cxf/blob/5ef794b0/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
index ef4dd52..965d3ef 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.rs.security.jose.jws;
 
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
 import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 import org.apache.cxf.rs.security.jose.jwt.JwtHeadersWriter;
@@ -70,6 +71,10 @@ public class JwsCompactProducer {
         return getUnsignedEncodedJws() + "." + (noSignature ? "" : signature);
     }
     
+    public String signWith(JsonWebKey jwk) {
+        return signWith(JwsUtils.getSignatureProvider(jwk));
+    }
+    
     public String signWith(JwsSignatureProvider signer) { 
         JwsSignature worker = signer.createJwsSignature(getHeaders());
         try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/5ef794b0/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
index 20b2672..e46f579 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsUtils.java
@@ -46,6 +46,9 @@ public final class JwsUtils {
         }
         return theSigProvider;
     }
+    public static JwsSignatureVerifier getSignatureVerifier(JsonWebKey jwk) {
+        return getSignatureVerifier(jwk, null);
+    }
     public static JwsSignatureVerifier getSignatureVerifier(JsonWebKey jwk, String defaultAlgorithm)
{
         String rsaSignatureAlgo = jwk.getAlgorithm() == null ? defaultAlgorithm : jwk.getAlgorithm();
         JwsSignatureVerifier theVerifier = null;


Mime
View raw message