cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/3] cxf git commit: Remove "Properties" from SecurityToken
Date Tue, 24 Mar 2015 12:17:07 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 6400b3cd1 -> 494ff7640


Remove "Properties" from SecurityToken


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

Branch: refs/heads/master
Commit: 494ff7640d78b1667547c8aacfc1d517fff00ef8
Parents: 5f94e27
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Mar 24 12:16:11 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Mar 24 12:17:01 2015 +0000

----------------------------------------------------------------------
 .../policy/interceptors/STSTokenHelper.java      | 19 +++++++++----------
 .../SecureConversationInInterceptor.java         |  6 +++---
 .../ws/security/tokenstore/SecurityToken.java    |  8 ++++----
 .../org/apache/cxf/sts/cache/CacheUtils.java     | 12 ++++++------
 .../cxf/sts/token/provider/SCTProvider.java      | 13 +++++++------
 .../cxf/sts/token/renewer/SAMLTokenRenewer.java  |  3 +--
 .../sts/token/validator/SAMLTokenValidator.java  |  5 ++---
 .../cxf/sts/token/validator/SCTValidator.java    |  5 ++---
 .../token/validator/UsernameTokenValidator.java  |  6 +++---
 9 files changed, 37 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSTokenHelper.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSTokenHelper.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSTokenHelper.java
index 57e9c6d..45af0ec 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSTokenHelper.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/STSTokenHelper.java
@@ -19,13 +19,12 @@
 
 package org.apache.cxf.ws.security.policy.interceptors;
 
+import java.util.HashMap;
 import java.util.Map;
-import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
@@ -329,9 +328,9 @@ public final class STSTokenHelper {
             String id = getIdFromToken(onBehalfOfToken);
             SecurityToken cachedToken = tokenStore.getToken(id);
             if (cachedToken != null) {
-                Properties properties = cachedToken.getProperties();
+                Map<String, Object> properties = cachedToken.getProperties();
                 if (properties != null && properties.containsKey(key)) {
-                    String associatedToken = properties.getProperty(key);
+                    String associatedToken = (String)properties.get(key);
                     SecurityToken issuedToken = tokenStore.getToken(associatedToken);
                     if (issuedToken != null) {
                         return issuedToken;
@@ -346,9 +345,9 @@ public final class STSTokenHelper {
             String id = getIdFromToken(actAsToken);
             SecurityToken cachedToken = tokenStore.getToken(id);
             if (cachedToken != null) {
-                Properties properties = cachedToken.getProperties();
+                Map<String, Object>  properties = cachedToken.getProperties();
                 if (properties != null && properties.containsKey(key)) {
-                    String associatedToken = properties.getProperty(key);
+                    String associatedToken = (String)properties.get(key);
                     SecurityToken issuedToken = tokenStore.getToken(associatedToken);
                     if (issuedToken != null) {
                         return issuedToken;
@@ -395,9 +394,9 @@ public final class STSTokenHelper {
                 cachedToken = new SecurityToken(id);
                 cachedToken.setToken(onBehalfOfToken);
             }
-            Properties properties = cachedToken.getProperties();
+            Map<String, Object> properties = cachedToken.getProperties();
             if (properties == null) {
-                properties = new Properties();
+                properties = new HashMap<>();
                 cachedToken.setProperties(properties);
             }
             properties.put(key, issuedToken.getId());
@@ -410,9 +409,9 @@ public final class STSTokenHelper {
                 cachedToken = new SecurityToken(id);
                 cachedToken.setToken(actAsToken);
             }
-            Properties properties = cachedToken.getProperties();
+            Map<String, Object>  properties = cachedToken.getProperties();
             if (properties == null) {
-                properties = new Properties();
+                properties = new HashMap<>();
                 cachedToken.setProperties(properties);
             }
             properties.put(key, issuedToken.getId());

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
index 5bdab96..629c711 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
@@ -22,13 +22,13 @@ package org.apache.cxf.ws.security.policy.interceptors;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
@@ -410,7 +410,7 @@ class SecureConversationInInterceptor extends AbstractPhaseInterceptor<SoapMessa
             // Get Bootstrap Token
             SecurityToken bootstrapToken = getBootstrapToken(exchange.getInMessage());
             if (bootstrapToken != null) {
-                Properties properties = new Properties();
+                Map<String, Object> properties = new HashMap<>(1);
                 properties.put(SecurityToken.BOOTSTRAP_TOKEN_ID, bootstrapToken.getId());
                 token.setProperties(properties);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
index 3183d73..fd67795 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/SecurityToken.java
@@ -26,7 +26,7 @@ import java.security.cert.X509Certificate;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.util.Date;
-import java.util.Properties;
+import java.util.Map;
 
 import org.w3c.dom.Element;
 import org.apache.cxf.helpers.DOMUtils;
@@ -90,7 +90,7 @@ public class SecurityToken implements Serializable {
     /**
      * A bag to hold any other properties
      */
-    private Properties properties;
+    private Map<String, Object> properties;
 
     /**
      * The secret associated with the Token
@@ -239,14 +239,14 @@ public class SecurityToken implements Serializable {
     /**
      * @return Returns the properties.
      */
-    public Properties getProperties() {
+    public Map<String, Object> getProperties() {
         return properties;
     }
 
     /**
      * @param properties The properties to set.
      */
-    public void setProperties(Properties properties) {
+    public void setProperties(Map<String, Object> properties) {
         this.properties = properties;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/CacheUtils.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/CacheUtils.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/CacheUtils.java
index 0267d08..a774c7f 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/CacheUtils.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/cache/CacheUtils.java
@@ -22,10 +22,10 @@ package org.apache.cxf.sts.cache;
 import java.security.Principal;
 import java.util.Arrays;
 import java.util.Date;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.sts.STSConstants;
 import org.apache.cxf.sts.request.Renewing;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
@@ -49,10 +49,10 @@ public final class CacheUtils {
         securityToken.setToken(token);
         securityToken.setPrincipal(principal);
 
-        Properties props = new Properties();
+        Map<String, Object> props = new HashMap<>();
         securityToken.setProperties(props);
         if (realm != null) {
-            props.setProperty(STSConstants.TOKEN_REALM, realm);
+            props.put(STSConstants.TOKEN_REALM, realm);
         }
 
         // Handle Renewing logic
@@ -66,8 +66,8 @@ public final class CacheUtils {
                 String.valueOf(renewing.isAllowRenewingAfterExpiry())
             );
         } else {
-            props.setProperty(STSConstants.TOKEN_RENEWING_ALLOW, "true");
-            props.setProperty(STSConstants.TOKEN_RENEWING_ALLOW_AFTER_EXPIRY, "false");
+            props.put(STSConstants.TOKEN_RENEWING_ALLOW, "true");
+            props.put(STSConstants.TOKEN_RENEWING_ALLOW_AFTER_EXPIRY, "false");
         }
         
         return securityToken;

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
index a25e2e0..1024c17 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/provider/SCTProvider.java
@@ -20,7 +20,8 @@
 package org.apache.cxf.sts.token.provider;
 
 import java.util.Date;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -147,13 +148,13 @@ public class SCTProvider implements TokenProvider {
             token.setSecret(keyHandler.getSecret());
             token.setPrincipal(tokenParameters.getPrincipal());
             
-            Properties props = token.getProperties();
+            Map<String, Object> props = token.getProperties();
             if (props == null) {
-                props = new Properties();
+                props = new HashMap<>();
             }
             token.setProperties(props);
             if (tokenParameters.getRealm() != null) {
-                props.setProperty(STSConstants.TOKEN_REALM, tokenParameters.getRealm());
+                props.put(STSConstants.TOKEN_REALM, tokenParameters.getRealm());
             }
 
             // Handle Renewing logic
@@ -168,8 +169,8 @@ public class SCTProvider implements TokenProvider {
                     String.valueOf(renewing.isAllowRenewingAfterExpiry())
                 );
             } else {
-                props.setProperty(STSConstants.TOKEN_RENEWING_ALLOW, "true");
-                props.setProperty(STSConstants.TOKEN_RENEWING_ALLOW_AFTER_EXPIRY, "false");
+                props.put(STSConstants.TOKEN_RENEWING_ALLOW, "true");
+                props.put(STSConstants.TOKEN_RENEWING_ALLOW_AFTER_EXPIRY, "false");
             }
             
             tokenParameters.getTokenStore().add(token);

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
index ecd8a53..ea6b016 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/renewer/SAMLTokenRenewer.java
@@ -26,7 +26,6 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -289,7 +288,7 @@ public class SAMLTokenRenewer extends AbstractSAMLTokenProvider implements
Token
         TokenRenewerParameters tokenParameters
     ) throws WSSecurityException {
         // Check the cached renewal properties
-        Properties props = token.getProperties();
+        Map<String, Object> props = token.getProperties();
         if (props == null) {
             LOG.log(Level.WARNING, "Error in getting properties from cached token");
             throw new STSException(

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
index 8ba1613..87562e4 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
@@ -24,7 +24,6 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -234,9 +233,9 @@ public class SAMLTokenValidator implements TokenValidator {
                 tokenRealm = samlRealmCodec.getRealmFromToken(assertion);
                 // verify the realm against the cached token
                 if (secToken != null) {
-                    Properties props = secToken.getProperties();
+                    Map<String, Object> props = secToken.getProperties();
                     if (props != null) {
-                        String cachedRealm = props.getProperty(STSConstants.TOKEN_REALM);
+                        String cachedRealm = (String)props.get(STSConstants.TOKEN_REALM);
                         if (cachedRealm != null && !tokenRealm.equals(cachedRealm))
{
                             return response;
                         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
index 4e2d8a2..605416a 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SCTValidator.java
@@ -20,7 +20,6 @@ package org.apache.cxf.sts.token.validator;
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -113,9 +112,9 @@ public class SCTValidator implements TokenValidator {
                 response.setAdditionalProperties(properties);
                 response.setPrincipal(token.getPrincipal());
                 
-                Properties props = token.getProperties();
+                Map<String, Object> props = token.getProperties();
                 if (props != null) {
-                    String realm = props.getProperty(STSConstants.TOKEN_REALM);
+                    String realm = (String)props.get(STSConstants.TOKEN_REALM);
                     response.setTokenRealm(realm);
                 }
                 validateTarget.setState(STATE.VALID);

http://git-wip-us.apache.org/repos/asf/cxf/blob/494ff764/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
index 31082ce..a321ade 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/UsernameTokenValidator.java
@@ -20,7 +20,7 @@ package org.apache.cxf.sts.token.validator;
 
 import java.security.Principal;
 import java.util.HashSet;
-import java.util.Properties;
+import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -215,9 +215,9 @@ public class UsernameTokenValidator implements TokenValidator {
                 tokenRealm = usernameTokenRealmCodec.getRealmFromToken(ut);
                 // verify the realm against the cached token
                 if (secToken != null) {
-                    Properties props = secToken.getProperties();
+                    Map<String, Object> props = secToken.getProperties();
                     if (props != null) {
-                        String cachedRealm = props.getProperty(STSConstants.TOKEN_REALM);
+                        String cachedRealm = (String)props.get(STSConstants.TOKEN_REALM);
                         if (!tokenRealm.equals(cachedRealm)) {
                             return response;
                         }


Mime
View raw message