Fix for CXF-5766 on 2.7.x
Conflicts:
rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0507c727
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0507c727
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0507c727
Branch: refs/heads/2.6.x-fixes
Commit: 0507c7271a27d4e91d4bd3342aa2ca2f5d9f559f
Parents: cc3f995
Author: Colm O hEigeartaigh <[email protected]>
Authored: Mon May 26 17:19:15 2014 +0100
Committer: Colm O hEigeartaigh <[email protected]>
Committed: Mon May 26 17:20:01 2014 +0100
----------------------------------------------------------------------
.../policy/interceptors/NegotiationUtils.java | 14 ++++
.../cxf/ws/security/wss4j/WSS4JUtils.java | 76 --------------------
2 files changed, 14 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/0507c727/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
----------------------------------------------------------------------
diff --git
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
index 8138a57..2ca43fa 100644
---
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
+++
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java
@@ -110,8 +110,22 @@ public final class NegotiationUtils {
if (create && tokenStore == null) {
TokenStoreFactory tokenStoreFactory =
TokenStoreFactory.newInstance();
String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
+<<<<<<< HEAD
if (info.getName() != null) {
cacheKey += "-" + info.getName().toString();
+=======
+ String cacheIdentifier =
+
(String)message.getContextualProperty(SecurityConstants.CACHE_IDENTIFIER);
+ if (cacheIdentifier != null) {
+ cacheKey += "-" + cacheIdentifier;
+ } else if (info.getName() != null) {
+ int hashcode = info.getName().toString().hashCode();
+ if (hashcode < 0) {
+ cacheKey += hashcode;
+ } else {
+ cacheKey += "-" + hashcode;
+ }
+>>>>>>> 0fe383e... Fix for CXF-5766 on 2.7.x
}
tokenStore = tokenStoreFactory.newTokenStore(cacheKey,
message);
info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE,
tokenStore);
http://git-wip-us.apache.org/repos/asf/cxf/blob/0507c727/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
----------------------------------------------------------------------
diff --git
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
index f851119..bc7f642 100644
---
a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
+++
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java
@@ -158,82 +158,6 @@ public final class WSS4JUtils {
}
return actionResultList;
}
-<<<<<<< HEAD
-=======
-
- public static TokenStore getTokenStore(Message message, boolean create) {
- EndpointInfo info =
message.getExchange().get(Endpoint.class).getEndpointInfo();
- synchronized (info) {
- TokenStore tokenStore =
-
(TokenStore)message.getContextualProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE);
- if (tokenStore == null) {
- tokenStore =
(TokenStore)info.getProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE);
- }
- if (create && tokenStore == null) {
- TokenStoreFactory tokenStoreFactory =
TokenStoreFactory.newInstance();
- String cacheKey = SecurityConstants.TOKEN_STORE_CACHE_INSTANCE;
- String cacheIdentifier =
-
(String)message.getContextualProperty(SecurityConstants.CACHE_IDENTIFIER);
- if (cacheIdentifier != null) {
- cacheKey += "-" + cacheIdentifier;
- } else if (info.getName() != null) {
- int hashcode = info.getName().toString().hashCode();
- if (hashcode < 0) {
- cacheKey += hashcode;
- } else {
- cacheKey += "-" + hashcode;
- }
- }
- tokenStore = tokenStoreFactory.newTokenStore(cacheKey,
message);
- info.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE,
tokenStore);
- }
- return tokenStore;
- }
- }
-
- public static String parseAndStoreStreamingSecurityToken(
- org.apache.xml.security.stax.securityToken.SecurityToken securityToken,
- Message message
- ) throws XMLSecurityException {
- if (securityToken == null) {
- return null;
- }
- SecurityToken existingToken =
getTokenStore(message).getToken(securityToken.getId());
- if (existingToken == null || existingToken.isExpired()) {
- Date created = new Date();
- Date expires = new Date();
- expires.setTime(created.getTime() + 300000);
-
- SecurityToken cachedTok = new SecurityToken(securityToken.getId(),
created, expires);
- cachedTok.setSHA1(securityToken.getSha1Identifier());
-
- if (securityToken.getTokenType() != null) {
- if (securityToken.getTokenType() ==
WSSecurityTokenConstants.EncryptedKeyToken) {
-
cachedTok.setTokenType(WSSConstants.NS_WSS_ENC_KEY_VALUE_TYPE);
- } else if (securityToken.getTokenType() ==
WSSecurityTokenConstants.KerberosToken) {
-
cachedTok.setTokenType(WSSConstants.NS_GSS_Kerberos5_AP_REQ);
- } else if (securityToken.getTokenType() ==
WSSecurityTokenConstants.Saml11Token) {
-
cachedTok.setTokenType(WSSConstants.NS_SAML11_TOKEN_PROFILE_TYPE);
- } else if (securityToken.getTokenType() ==
WSSecurityTokenConstants.Saml20Token) {
-
cachedTok.setTokenType(WSSConstants.NS_SAML20_TOKEN_PROFILE_TYPE);
- } else if (securityToken.getTokenType() ==
WSSecurityTokenConstants.SecureConversationToken
- || securityToken.getTokenType() ==
WSSecurityTokenConstants.SecurityContextToken) {
- cachedTok.setTokenType(WSSConstants.NS_WSC_05_02);
- }
- }
-
- for (String key : securityToken.getSecretKey().keySet()) {
- Key keyObject = securityToken.getSecretKey().get(key);
- if (keyObject != null) {
- cachedTok.setKey(keyObject);
- if (keyObject instanceof SecretKey) {
- cachedTok.setSecret(keyObject.getEncoded());
- }
- break;
- }
- }
- getTokenStore(message).add(cachedTok);
->>>>>>> 779cf32... [CXF-5766] - Caching nonces to disk may not work if the
service QName is too long
/**
>>>>>>> 49a9e00... [CXF-5766] - Caching nonces to disk may not work if the
>>>>>>> service QName is too long