cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5311] Passing properties to default handlers
Date Fri, 13 Jun 2014 11:24:21 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 0ccdc3930 -> b4909d605


[CXF-5311] Passing properties to default handlers


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

Branch: refs/heads/master
Commit: b4909d6050f5d8733f252b947a80a1ae15bcef25
Parents: 0ccdc39
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jun 13 12:24:08 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jun 13 12:24:08 2014 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java  | 3 +++
 .../oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java       | 8 +++++++-
 .../security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java   | 9 ++++++++-
 3 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b4909d60/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java
b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java
index 771590e..b9b892c 100644
--- a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java
+++ b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwe/WrappedKeyJweDecryptor.java
@@ -33,6 +33,9 @@ public class WrappedKeyJweDecryptor extends AbstractJweDecryptor {
     public WrappedKeyJweDecryptor(Key cekDecryptionKey, boolean unwrap) {    
         this(cekDecryptionKey, unwrap, null);
     }
+    public WrappedKeyJweDecryptor(Key cekDecryptionKey, JweCryptoProperties props) {
+        this(cekDecryptionKey, true, props);
+    }
     public WrappedKeyJweDecryptor(Key cekDecryptionKey, boolean unwrap,
                                   JweCryptoProperties props) {    
         super(props);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b4909d60/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java
b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java
index 5ef8993..6df6647 100644
--- a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java
+++ b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/AbstractJweDecryptingFilter.java
@@ -27,6 +27,7 @@ import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.rs.security.oauth2.jwe.JweCryptoProperties;
 import org.apache.cxf.rs.security.oauth2.jwe.JweDecryptionOutput;
 import org.apache.cxf.rs.security.oauth2.jwe.JweDecryptor;
 import org.apache.cxf.rs.security.oauth2.jwe.JweHeaders;
@@ -39,6 +40,7 @@ public class AbstractJweDecryptingFilter {
     private static final String RSSEC_KEY_PSWD_PROVIDER = "org.apache.rs.security.crypto.private.provider";
     
     private JweDecryptor decryptor;
+    private JweCryptoProperties cryptoProperties;
     protected byte[] decrypt(InputStream is) throws IOException {
         JweDecryptor theDecryptor = getInitializedDecryptor();
         if (theDecryptor == null) {
@@ -70,7 +72,11 @@ public class AbstractJweDecryptingFilter {
         PrivateKeyPasswordProvider cb = (PrivateKeyPasswordProvider)m.getContextualProperty(RSSEC_KEY_PSWD_PROVIDER);
         Bus bus = (Bus)m.getExchange().get(Endpoint.class).get(Bus.class.getName());
         PrivateKey pk = CryptoUtils.loadPrivateKey(propLoc, bus, cb);
-        return new WrappedKeyJweDecryptor(pk);
+        return new WrappedKeyJweDecryptor(pk, cryptoProperties);
+    }
+
+    public void setCryptoProperties(JweCryptoProperties cryptoProperties) {
+        this.cryptoProperties = cryptoProperties;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b4909d60/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java
b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java
index 96bd86f..3ab2626 100644
--- a/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2-jwt/src/main/java/org/apache/cxf/rs/security/oauth2/jwt/jaxrs/JwsMessageBodyProvider.java
@@ -40,6 +40,7 @@ import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.oauth2.jws.JwsCompactConsumer;
 import org.apache.cxf.rs.security.oauth2.jws.JwsCompactProducer;
+import org.apache.cxf.rs.security.oauth2.jws.JwsSignatureProperties;
 import org.apache.cxf.rs.security.oauth2.jws.JwsSignatureProvider;
 import org.apache.cxf.rs.security.oauth2.jws.JwsSignatureVerifier;
 import org.apache.cxf.rs.security.oauth2.jws.PrivateKeyJwsSignatureProvider;
@@ -53,6 +54,7 @@ public class JwsMessageBodyProvider implements
     private static final String RSSEC_SIGNATURE_PROPS = "rs-security.signature.properties";
     private static final String RSSEC_KEY_PSWD_PROVIDER = "org.apache.rs.security.crypto.private.provider";
     
+    private JwsSignatureProperties sigProperties;
     private JwsSignatureProvider sigProvider;
     private JwsSignatureVerifier sigVerifier;
     
@@ -69,7 +71,8 @@ public class JwsMessageBodyProvider implements
         if (theSigVerifier == null) {
             throw new SecurityException();
         }
-        JwsCompactConsumer p = new JwsCompactConsumer(IOUtils.readStringFromStream(is));
+        JwsCompactConsumer p = new JwsCompactConsumer(IOUtils.readStringFromStream(is), 
+                                                      sigProperties);
         p.verifySignatureWith(theSigVerifier);
         return p.getJwtToken();
     }
@@ -144,4 +147,8 @@ public class JwsMessageBodyProvider implements
         PublicKey pk = CryptoUtils.loadPublicKey(propLoc, bus);
         return new PublicKeyJwsSignatureVerifier(pk);
     }
+
+    public void setSigProperties(JwsSignatureProperties sigProperties) {
+        this.sigProperties = sigProperties;
+    }
 }


Mime
View raw message