cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1394640 - in /cxf/trunk/services/sts: sts-core/src/main/java/org/apache/cxf/sts/claims/ sts-core/src/test/java/org/apache/cxf/sts/common/ sts-core/src/test/java/org/apache/cxf/sts/operation/ systests/advanced/src/test/java/org/apache/cxf/s...
Date Fri, 05 Oct 2012 17:03:28 GMT
Author: dkulp
Date: Fri Oct  5 17:03:27 2012
New Revision: 1394640

URL: http://svn.apache.org/viewvc?rev=1394640&view=rev
Log:
Change Claims value to List<String> to support multiple values

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/Claim.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsAttributeStatementProvider.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapClaimsHandler.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticClaimsHandler.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticEndpointClaimsHandler.java
    cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java
    cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
    cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
    cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
    cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
    cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/Claim.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/Claim.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/Claim.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/Claim.java Fri
Oct  5 17:03:27 2012
@@ -22,6 +22,8 @@ package org.apache.cxf.sts.claims;
 import java.io.Serializable;
 import java.net.URI;
 import java.security.Principal;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * This represents a Claim that has been processed by a ClaimsHandler instance.
@@ -36,7 +38,7 @@ public class Claim implements Serializab
     private String issuer;
     private String originalIssuer;
     private transient Principal principal;
-    private String value;
+    private List<String> values = new ArrayList<String>(1);
 
     public String getIssuer() {
         return issuer;
@@ -70,12 +72,22 @@ public class Claim implements Serializab
         this.principal = principal;
     }
 
-    public void setValue(String value) {
-        this.value = value;
+    public void setValues(List<String> values) {
+        this.values.clear();
+        this.values.addAll(values);
     }
 
-    public String getValue() {
-        return value;
+    public void setValue(String value) {
+        this.values.clear();
+        this.values.add(value);
+    }
+    
+    public void addValue(String s) {
+        this.values.add(s);
+    }
+    
+    public List<String> getValues() {
+        return values;
     }
 
 }

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsAttributeStatementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsAttributeStatementProvider.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsAttributeStatementProvider.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsAttributeStatementProvider.java
Fri Oct  5 17:03:27 2012
@@ -20,7 +20,6 @@ package org.apache.cxf.sts.claims;
 
 import java.net.URI;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -100,7 +99,7 @@ public class ClaimsAttributeStatementPro
                 attributeBean.setSimpleName(name);
                 attributeBean.setQualifiedName(namespace);
             }
-            attributeBean.setAttributeValues(Collections.singletonList(claim.getValue()));
+            attributeBean.setAttributeValues(claim.getValues());
             attributeList.add(attributeBean);
         }
         attrBean.setSamlAttributes(attributeList);

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsManager.java
Fri Oct  5 17:03:27 2012
@@ -186,7 +186,7 @@ public class ClaimsManager {
                     if (LOG.isLoggable(Level.FINEST)) {
                         LOG.finest(" [" + value + "]");
                     }
-                    c.setValue(value);
+                    c.addValue(value);
                     collection.add(c);
                     break;                    
                 }
@@ -225,7 +225,7 @@ public class ClaimsManager {
                     if (LOG.isLoggable(Level.FINEST)) {
                         LOG.finest(" [" + value + "]");
                     }
-                    c.setValue(value);
+                    c.addValue(value);
                     collection.add(c);
                     break;
                 }

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/LdapClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -247,7 +247,7 @@ public class LdapClaimsHandler implement
                     LOG.warning("Failed to read value of LDAP attribute '" + ldapAttribute
+ "'");
                 }
                 
-                c.setValue(claimValue.toString());
+                c.addValue(claimValue.toString());
                 // c.setIssuer(issuer);
                 // c.setOriginalIssuer(originalIssuer);
                 // c.setNamespace(namespace);

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -66,7 +66,7 @@ public class StaticClaimsHandler impleme
                 Claim c = new Claim();
                 c.setClaimType(claim.getClaimType());
                 c.setPrincipal(parameters.getPrincipal());
-                c.setValue(getGlobalClaims().get(claim.getClaimType().toString()));
+                c.addValue(getGlobalClaims().get(claim.getClaimType().toString()));
                 claimsColl.add(c);
             } else {
                 if (LOG.isLoggable(Level.FINER)) {

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticEndpointClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticEndpointClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticEndpointClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/StaticEndpointClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -75,7 +75,7 @@ public class StaticEndpointClaimsHandler
                 Claim c = new Claim();
                 c.setClaimType(claim.getClaimType());
                 c.setPrincipal(parameters.getPrincipal());
-                c.setValue(endpointClaims.get(claim.getClaimType().toString()));
+                c.addValue(endpointClaims.get(claim.getClaimType().toString()));
                 claimsColl.add(c);
             } else {
                 if (LOG.isLoggable(Level.FINER)) {

Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java
Fri Oct  5 17:03:27 2012
@@ -180,7 +180,7 @@ public class CustomAttributeProvider imp
         } else {
             attributeBean.setSimpleName(claim.getClaimType().toString());
         }
-        attributeBean.setAttributeValues(Collections.singletonList(claim.getValue()));
+        attributeBean.setAttributeValues(claim.getValues());
 
         return attributeBean;
     }

Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -64,18 +64,18 @@ public class CustomClaimsHandler impleme
                     if (requestClaim instanceof CustomRequestClaim) {
                         CustomRequestClaim customClaim = (CustomRequestClaim) requestClaim;
                         String customName = customClaim.getClaimValue() + "@" + customClaim.getScope();
-                        claim.setValue(customName);
+                        claim.addValue(customName);
                     } else {
-                        claim.setValue("alice");
+                        claim.addValue("alice");
                     }
                 } else if (ClaimTypes.LASTNAME.equals(requestClaim.getClaimType())) {
-                    claim.setValue("doe");
+                    claim.addValue("doe");
                 } else if (ClaimTypes.EMAILADDRESS.equals(requestClaim.getClaimType())) {
-                    claim.setValue("alice@cxf.apache.org");
+                    claim.addValue("alice@cxf.apache.org");
                 } else if (ROLE_CLAIM.equals(requestClaim.getClaimType())) {
                     String requestedRole = requestClaim.getClaimValue();
                     if (isUserInRole(parameters.getPrincipal(), requestedRole)) {
-                        claim.setValue(requestedRole);
+                        claim.addValue(requestedRole);
                     } else {
                         continue;
                     }

Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -56,9 +56,9 @@ public class CustomUserClaimsHandler imp
                 if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                     
                     if (parameters.getPrincipal().getName().equalsIgnoreCase("alice")) {
-                        claim.setValue("aliceClaim");
+                        claim.addValue("aliceClaim");
                     } else if (parameters.getPrincipal().getName().equalsIgnoreCase("bob"))
{
-                        claim.setValue("bobClaim");
+                        claim.addValue("bobClaim");
                     }
                 }                
                 claimCollection.add(claim);

Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
Fri Oct  5 17:03:27 2012
@@ -44,7 +44,9 @@ public class CustomClaimsMapper implemen
             nc.setIssuer(c.getIssuer());
             nc.setOriginalIssuer(c.getOriginalIssuer());
             nc.setPrincipal(c.getPrincipal());
-            nc.setValue(c.getValue().toUpperCase());
+            for (String s : c.getValues()) {
+                nc.addValue(s.toUpperCase());            
+            }
             targetClaims.add(nc);
         }
         

Modified: cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
(original)
+++ cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
Fri Oct  5 17:03:27 2012
@@ -20,7 +20,6 @@ package org.apache.cxf.systest.sts.deplo
 
 import java.net.URI;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -98,7 +97,7 @@ public class CustomAttributeStatementPro
                 attributeBean.setSimpleName(name);
                 attributeBean.setQualifiedName(namespace);
             }
-            attributeBean.setAttributeValues(Collections.singletonList(claim.getValue()));
+            attributeBean.setAttributeValues(claim.getValues());
             attributeList.add(attributeBean);
         }
         attrBean.setSamlAttributes(attributeList);

Modified: cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java?rev=1394640&r1=1394639&r2=1394640&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
Fri Oct  5 17:03:27 2012
@@ -52,11 +52,11 @@ public class CustomClaimsHandler impleme
                 claim.setIssuer("Test Issuer");
                 claim.setOriginalIssuer("Original Issuer");
                 if (ROLE.equals(requestClaim.getClaimType())) {
-                    claim.setValue("admin-user");
+                    claim.addValue("admin-user");
                 } else if (GIVEN_NAME.equals(requestClaim.getClaimType())) {
-                    claim.setValue(parameters.getPrincipal().getName());
+                    claim.addValue(parameters.getPrincipal().getName());
                 } else if (LANGUAGE.equals(requestClaim.getClaimType())) {
-                    claim.setValue(parameters.getPrincipal().getName());
+                    claim.addValue(parameters.getPrincipal().getName());
                 }
                 claimCollection.add(claim);
             }



Mime
View raw message