You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/02/29 13:58:07 UTC
cxf git commit: [CXF-6725] Deprecating JwsJson list properties as
they do not add any additional value compared to the plain RSSEC JWS
properties
Repository: cxf
Updated Branches:
refs/heads/master ec3103f88 -> bf98849dc
[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/bf98849d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bf98849d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bf98849d
Branch: refs/heads/master
Commit: bf98849dc890d891f422ad7dfd62bc1645b8ed88
Parents: ec3103f
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Mon Feb 29 12:57:47 2016 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Mon Feb 29 12:57:47 2016 +0000
----------------------------------------------------------------------
.../jaxrs/AbstractJwsJsonReaderProvider.java | 10 +++++++--
.../jaxrs/AbstractJwsJsonWriterProvider.java | 10 +++++++--
.../rs/security/jose/common/JoseConstants.java | 22 +++++++++++++-------
.../cxf/rs/security/jose/jws/JwsUtils.java | 2 +-
.../security/jose/jwejws/JAXRSJwsJsonTest.java | 8 ++++---
.../security/jose/jwejws/serverJwsJson.xml | 6 +++---
6 files changed, 39 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/bf98849d/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/bf98849d/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/bf98849d/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 7069069..7287184 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
@@ -161,21 +161,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/bf98849d/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 df21aab..ce6fa1e 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,7 +301,7 @@ public final class JwsUtils {
return loadSignatureProvider(PhaseInterceptorChain.getCurrentMessage(),
props, headers, false);
}
- public static JwsSignatureProvider loadSignatureProvider(Message m,
+ private static JwsSignatureProvider loadSignatureProvider(Message m,
Properties props,
JwsHeaders headers,
boolean ignoreNullProvider) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/bf98849d/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 92fc5b2..58c6f2b 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;
@@ -95,11 +96,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);
@@ -160,7 +162,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/bf98849d/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>