cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6725] Deprecating JwsJson list properties as they do not add any additional value compared to the plain RSSEC JWS properties
Date Mon, 29 Feb 2016 13:24:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes a626a1215 -> 2b98ad966


[CXF-6725] Deprecating JwsJson list properties as they do not add any additional value compared
to the plain RSSEC JWS properties


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

Branch: refs/heads/3.0.x-fixes
Commit: 2b98ad96658e303c4e3a9ef924b308a0b78369cb
Parents: a626a12
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Feb 29 12:57:47 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Feb 29 13:23:49 2016 +0000

----------------------------------------------------------------------
 .../jaxrs/AbstractJwsJsonReaderProvider.java    | 10 +++++++--
 .../jaxrs/AbstractJwsJsonWriterProvider.java    | 10 +++++++--
 .../rs/security/jose/common/JoseConstants.java  | 22 +++++++++++++-------
 .../security/jose/jwejws/JAXRSJwsJsonTest.java  |  8 ++++---
 .../security/jose/jwejws/serverJwsJson.xml      |  6 +++---
 5 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2b98ad96/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonReaderProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonReaderProvider.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonReaderProvider.java
index 6243bef..c2c3031 100644
--- a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonReaderProvider.java
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonReaderProvider.java
@@ -48,14 +48,20 @@ public class AbstractJwsJsonReaderProvider {
         this.sigVerifiers = signatureVerifiers;
     }
 
+    @SuppressWarnings("deprecation")
     protected List<JwsSignatureVerifier> getInitializedSigVerifiers() {
         if (sigVerifiers != null) {
             return sigVerifiers;    
         }
         Message m = JAXRSUtils.getCurrentMessage();
         Object propLocsProp = 
-            MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_SIGNATURE_IN_LIST_PROPS,

-                                               JoseConstants.RSSEC_SIGNATURE_LIST_PROPS);
+            MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_SIGNATURE_IN_PROPS,

+                                               JoseConstants.RSSEC_SIGNATURE_PROPS);
+        if (propLocsProp == null) {
+            propLocsProp = 
+                MessageUtils.getContextualProperty(m, JoseConstants.DEP_RSSEC_SIGNATURE_IN_LIST_PROPS,

+                                               JoseConstants.DEP_RSSEC_SIGNATURE_LIST_PROPS);
+        }
         if (propLocsProp == null) {
             LOG.warning("JWS JSON init properties resource is not identified");
             throw new JwsException(JwsException.Error.NO_INIT_PROPERTIES);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b98ad96/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
index 1d2e645..bae484b 100644
--- a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJwsJsonWriterProvider.java
@@ -52,14 +52,20 @@ public class AbstractJwsJsonWriterProvider {
         this.sigProviders = signatureProviders;
     }
     
+    @SuppressWarnings("deprecation")
     protected List<JwsSignatureProvider> getInitializedSigProviders() {
         if (sigProviders != null) {
             return sigProviders;    
         } 
         Message m = JAXRSUtils.getCurrentMessage();
         Object propLocsProp = 
-            MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_SIGNATURE_OUT_LIST_PROPS,

-                                               JoseConstants.RSSEC_SIGNATURE_LIST_PROPS);
+            MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_SIGNATURE_OUT_PROPS,

+                                               JoseConstants.RSSEC_SIGNATURE_PROPS);
+        if (propLocsProp == null) {
+            propLocsProp = 
+                MessageUtils.getContextualProperty(m, JoseConstants.DEP_RSSEC_SIGNATURE_OUT_LIST_PROPS,

+                                               JoseConstants.DEP_RSSEC_SIGNATURE_LIST_PROPS);
+        }
         if (propLocsProp == null) {
             LOG.warning("JWS JSON init properties resource is not identified");
             throw new JwsException(JwsException.Error.NO_INIT_PROPERTIES);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b98ad96/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
index daf7c5a..8aed10e 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
@@ -156,21 +156,27 @@ public final class JoseConstants {
     public static final String RSSEC_SIGNATURE_PROPS = "rs.security.signature.properties";
     
     /**
-     * The signature properties file for JSON Serialization signature creation. If not specified
then it 
-     * falls back to RSSEC_SIGNATURE_LIST_PROPS.
+     * The OLD signature properties file for JSON Serialization signature creation. 
+     * If not specified then it falls back to RSSEC_SIGNATURE_LIST_PROPS.
+     * Use RSSEC_SIGNATURE_OUT_PROPS instead
      */
-    public static final String RSSEC_SIGNATURE_OUT_LIST_PROPS = "rs.security.signature.out.list.properties";
+    @Deprecated
+    public static final String DEP_RSSEC_SIGNATURE_OUT_LIST_PROPS = "rs.security.signature.out.list.properties";
     
     /**
-     * The signature properties file for JSON Serialization signature verification. If not
specified then it 
-     * falls back to RSSEC_SIGNATURE_LIST_PROPS.
+     * The OLD signature properties file for JSON Serialization signature verification. 
+     * If not specified then it falls back to RSSEC_SIGNATURE_LIST_PROPS.
+     * Use RSSEC_SIGNATURE_IN_PROPS instead
      */
-    public static final String RSSEC_SIGNATURE_IN_LIST_PROPS = "rs.security.signature.in.list.properties";
+    @Deprecated
+    public static final String DEP_RSSEC_SIGNATURE_IN_LIST_PROPS = "rs.security.signature.in.list.properties";
     
     /**
-     * The signature properties file for JSON Serialization signature creation/verification.
+     * The OLD signature properties file for JSON Serialization signature creation/verification.
+     * Use RSSEC_SIGNATURE_PROPS instead
      */
-    public static final String RSSEC_SIGNATURE_LIST_PROPS = "rs.security.signature.list.properties";
+    @Deprecated
+    public static final String DEP_RSSEC_SIGNATURE_LIST_PROPS = "rs.security.signature.list.properties";
     
     /**
      * Include the JWK public key for signature in the "jwk" header. 

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b98ad96/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
index 32dd05a..e5a38ba 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jose/jwejws/JAXRSJwsJsonTest.java
@@ -36,6 +36,7 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.rs.security.jose.common.JoseConstants;
 import org.apache.cxf.rs.security.jose.jaxrs.JweClientResponseFilter;
 import org.apache.cxf.rs.security.jose.jaxrs.JweWriterInterceptor;
 import org.apache.cxf.rs.security.jose.jaxrs.JwsJsonClientResponseFilter;
@@ -100,11 +101,12 @@ public class JAXRSJwsJsonTest extends AbstractBusClientServerTestBase
{
         String address = "https://localhost:" + PORT + "/jwejwsjsonhmac";
         List<?> extraProviders = Arrays.asList(new JacksonJsonProvider(),
                                                new JweWriterInterceptor(),
+                                               new JwsJsonWriterInterceptor(),
                                                new JweClientResponseFilter());
         String jwkStoreProperty = "org/apache/cxf/systest/jaxrs/security/secret.jwk.properties";
         Map<String, Object> props = new HashMap<String, Object>();
-        props.put("rs.security.signature.list.properties", jwkStoreProperty);
-        props.put("rs.security.encryption.properties", jwkStoreProperty);
+        props.put(JoseConstants.RSSEC_SIGNATURE_PROPS, jwkStoreProperty);
+        props.put(JoseConstants.RSSEC_ENCRYPTION_PROPS, jwkStoreProperty);
         BookStore bs = createBookStore(address, 
                                        props,
                                        extraProviders);
@@ -165,7 +167,7 @@ public class JAXRSJwsJsonTest extends AbstractBusClientServerTestBase
{
     private BookStore createBookStore(String address, Object properties,
                                       List<?> extraProviders) throws Exception {
         return createBookStore(address, 
-                               Collections.singletonMap("rs.security.signature.list.properties",
properties),
+                               Collections.singletonMap(JoseConstants.RSSEC_SIGNATURE_PROPS,
properties),
                                extraProviders);
     }
     private BookStore createBookStore(String address, 

http://git-wip-us.apache.org/repos/asf/cxf/blob/2b98ad96/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverJwsJson.xml
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverJwsJson.xml
b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverJwsJson.xml
index df233bb..1cf78c8 100644
--- a/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverJwsJson.xml
+++ b/systests/rs-security/src/test/resources/org/apache/cxf/systest/jaxrs/security/jose/jwejws/serverJwsJson.xml
@@ -52,7 +52,7 @@ under the License.
             <ref bean="jackson"/>
         </jaxrs:providers>
         <jaxrs:properties>
-            <entry key="rs.security.signature.list.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/>
+            <entry key="rs.security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/>
         </jaxrs:properties>
     </jaxrs:server>
     <bean id="jweInFilter" class="org.apache.cxf.rs.security.jose.jaxrs.JweContainerRequestFilter"/>
@@ -69,7 +69,7 @@ under the License.
             <ref bean="jackson"/>
         </jaxrs:providers>
         <jaxrs:properties>
-            <entry key="rs.security.signature.list.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/>
+            <entry key="rs.security.signature.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/>
             <entry key="rs.security.encryption.properties" value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties"/>
         </jaxrs:properties>
     </jaxrs:server>
@@ -82,7 +82,7 @@ under the License.
             <ref bean="jwsOutFilter"/>
         </jaxrs:providers>
         <jaxrs:properties>
-            <entry key="rs.security.signature.list.properties" 
+            <entry key="rs.security.signature.properties" 
             value="org/apache/cxf/systest/jaxrs/security/secret.jwk.properties,org/apache/cxf/systest/jaxrs/security/secret.jwk.hmac.properties"/>
         </jaxrs:properties>
     </jaxrs:server>


Mime
View raw message