cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/4] Moving STS's RequestClaim(Collection) to rt-security. Renaming STS's Claim(Collection) to ProcessedClaim(Collection). Add the ability to add ClaimCollection Objects to a RST in the AbstractSTSClient
Date Thu, 06 Mar 2014 12:43:27 GMT
Repository: cxf
Updated Branches:
  refs/heads/claims [created] cae108db6


http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
index 9728cf0..3f533dc 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimsHandler.java
@@ -23,13 +23,13 @@ import java.security.Principal;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimTypes;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsParameters;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 import org.apache.cxf.sts.common.CustomClaimParser.CustomRequestClaim;
 import org.opensaml.Configuration;
 import org.opensaml.saml2.core.AttributeValue;
@@ -59,18 +59,19 @@ public class CustomClaimsHandler implements ClaimsHandler {
         return knownURIs;
     }    
     
-    public ClaimCollection retrieveClaimValues(
-            RequestClaimCollection claims, ClaimsParameters parameters) {
+    public ProcessedClaimCollection retrieveClaimValues(
+            ClaimCollection claims, ClaimsParameters parameters) {
       
         if (claims != null && claims.size() > 0) {
-            ClaimCollection claimCollection = new ClaimCollection();
-            for (RequestClaim requestClaim : claims) {
-                Claim claim = new Claim();
+            ProcessedClaimCollection claimCollection = new ProcessedClaimCollection();
+            for (Claim requestClaim : claims) {
+                ProcessedClaim claim = new ProcessedClaim();
                 claim.setClaimType(requestClaim.getClaimType());
                 if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                     if (requestClaim instanceof CustomRequestClaim) {
                         CustomRequestClaim customClaim = (CustomRequestClaim) requestClaim;
-                        String customName = customClaim.getClaimValue() + "@" + customClaim.getScope();
+                        String customName = customClaim.getValues().get(0) + "@" 
+                            + customClaim.getScope();
                         claim.addValue(customName);
                     } else {
                         claim.addValue("alice");
@@ -95,7 +96,7 @@ public class CustomClaimsHandler implements ClaimsHandler {
                     claim.addValue(attributeValue);
 
                 } else if (ROLE_CLAIM.equals(requestClaim.getClaimType())) {
-                    String requestedRole = requestClaim.getClaimValue();
+                    String requestedRole = (String)requestClaim.getValues().get(0);
                     if (isUserInRole(parameters.getPrincipal(), requestedRole)) {
                         claim.addValue(requestedRole);
                     } else {

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
index 72903ca..08b40af 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomUserClaimsHandler.java
@@ -22,13 +22,13 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimTypes;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsParameters;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 
 /**
  * A custom ClaimsHandler implementation for use in the tests.
@@ -45,13 +45,13 @@ public class CustomUserClaimsHandler implements ClaimsHandler {
         return knownURIs;
     }    
     
-    public ClaimCollection retrieveClaimValues(
-            RequestClaimCollection claims, ClaimsParameters parameters) {
+    public ProcessedClaimCollection retrieveClaimValues(
+            ClaimCollection claims, ClaimsParameters parameters) {
         
         if (claims != null && claims.size() > 0) {
-            ClaimCollection claimCollection = new ClaimCollection();
-            for (RequestClaim requestClaim : claims) {
-                Claim claim = new Claim();
+            ProcessedClaimCollection claimCollection = new ProcessedClaimCollection();
+            for (Claim requestClaim : claims) {
+                ProcessedClaim claim = new ProcessedClaim();
                 claim.setClaimType(requestClaim.getClaimType());
                 if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                     

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/RealmSupportClaimsHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/RealmSupportClaimsHandler.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/RealmSupportClaimsHandler.java
index 0b8dfcd..0ddd090 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/RealmSupportClaimsHandler.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/RealmSupportClaimsHandler.java
@@ -21,12 +21,12 @@ package org.apache.cxf.sts.common;
 import java.net.URI;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsParameters;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 import org.apache.cxf.sts.token.realm.RealmSupport;
 import org.junit.Assert;
 
@@ -57,8 +57,8 @@ public class RealmSupportClaimsHandler implements ClaimsHandler, RealmSupport
{
         this.supportedClaimTypes = supportedClaimTypes;
     }
     
-    public ClaimCollection retrieveClaimValues(
-            RequestClaimCollection claims, ClaimsParameters parameters) {
+    public ProcessedClaimCollection retrieveClaimValues(
+            ClaimCollection claims, ClaimsParameters parameters) {
         
         if ("A".equals(realm)) {
             Assert.assertEquals("ClaimHandler in realm A. Alice username must be 'alice'",
@@ -76,10 +76,10 @@ public class RealmSupportClaimsHandler implements ClaimsHandler, RealmSupport
{
         }
         
         if (claims != null && claims.size() > 0) {
-            ClaimCollection claimCollection = new ClaimCollection();
-            for (RequestClaim requestClaim : claims) {
+            ProcessedClaimCollection claimCollection = new ProcessedClaimCollection();
+            for (Claim requestClaim : claims) {
                 if (getSupportedClaimTypes().indexOf(requestClaim.getClaimType()) != -1)
{
-                    Claim claim = new Claim();
+                    ProcessedClaim claim = new ProcessedClaim();
                     claim.setClaimType(requestClaim.getClaimType());
                     claim.addValue("Value_" + requestClaim.getClaimType());
                     claimCollection.add(claim);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
index 341efd3..6751131 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
@@ -34,13 +34,13 @@ import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimTypes;
 import org.apache.cxf.sts.claims.ClaimsParameters;
 import org.apache.cxf.sts.claims.LdapClaimsHandler;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 import org.apache.cxf.ws.security.sts.provider.STSException;
 import org.apache.wss4j.common.principal.CustomTokenPrincipal;
 import org.junit.BeforeClass;
@@ -83,7 +83,7 @@ public class LDAPClaimsTest {
         String user = props.getProperty("claimUser");
         Assert.notNull(user, "Property 'claimUser' not configured");
 
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createRequestClaimCollection();
 
         List<URI> expectedClaims = new ArrayList<URI>();
         expectedClaims.add(ClaimTypes.FIRSTNAME);
@@ -92,7 +92,7 @@ public class LDAPClaimsTest {
        
         ClaimsParameters params = new ClaimsParameters();
         params.setPrincipal(new CustomTokenPrincipal(user));
-        ClaimCollection retrievedClaims = 
+        ProcessedClaimCollection retrievedClaims = 
             claimsHandler.retrieveClaimValues(requestedClaims, params);
 
         Assert.isTrue(
@@ -101,7 +101,7 @@ public class LDAPClaimsTest {
                       + "] doesn't match with expected [" + expectedClaims.size() + "]"
         );
 
-        for (Claim c : retrievedClaims) {
+        for (ProcessedClaim c : retrievedClaims) {
             if (expectedClaims.contains(c.getClaimType())) {
                 expectedClaims.remove(c.getClaimType());
             } else {
@@ -120,9 +120,9 @@ public class LDAPClaimsTest {
         String user = props.getProperty("claimUser");
         Assert.notNull(user, "Property 'claimUser' not configured");
 
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createRequestClaimCollection();
         // add unsupported but mandatory claim
-        RequestClaim claim = new RequestClaim();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.GENDER);
         claim.setOptional(false);
         requestedClaims.add(claim);
@@ -140,9 +140,9 @@ public class LDAPClaimsTest {
         String user = props.getProperty("claimUser");
         Assert.notNull(user, "Property 'claimUser' not configured");
 
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createRequestClaimCollection();
         // add unsupported but optional unsupported claim
-        RequestClaim claim = new RequestClaim();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.GENDER);
         claim.setOptional(true);
         requestedClaims.add(claim);
@@ -155,7 +155,7 @@ public class LDAPClaimsTest {
         
         ClaimsParameters params = new ClaimsParameters();
         params.setPrincipal(new CustomTokenPrincipal(user));
-        ClaimCollection retrievedClaims = 
+        ProcessedClaimCollection retrievedClaims = 
             claimsHandler.retrieveClaimValues(requestedClaims, params);
 
         Assert.isTrue(
@@ -164,7 +164,7 @@ public class LDAPClaimsTest {
                       + "] doesn't match with expected [" + expectedClaims.size() + "]"
         );
 
-        for (Claim c : retrievedClaims) {
+        for (ProcessedClaim c : retrievedClaims) {
             if (expectedClaims.contains(c.getClaimType())) {
                 expectedClaims.remove(c.getClaimType());
             } else {
@@ -173,17 +173,17 @@ public class LDAPClaimsTest {
         }
     }
 
-    private RequestClaimCollection createRequestClaimCollection() {
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+    private ClaimCollection createRequestClaimCollection() {
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.FIRSTNAME);
         claim.setOptional(true);
         claims.add(claim);
-        claim = new RequestClaim();
+        claim = new Claim();
         claim.setClaimType(ClaimTypes.LASTNAME);
         claim.setOptional(true);
         claims.add(claim);
-        claim = new RequestClaim();
+        claim = new Claim();
         claim.setClaimType(ClaimTypes.EMAILADDRESS);
         claim.setOptional(true);
         claims.add(claim);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
index 80b6c1c..5881b3d 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/CustomClaimsMapper.java
@@ -19,10 +19,10 @@
 
 package org.apache.cxf.sts.operation;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimsMapper;
 import org.apache.cxf.sts.claims.ClaimsParameters;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 
 /**
  * A test implementation of ClaimsMapper.
@@ -32,14 +32,14 @@ public class CustomClaimsMapper implements ClaimsMapper {
     /**
      * transforms the claim values to upper-case
      */
-    public ClaimCollection mapClaims(String sourceRealm,
-            ClaimCollection sourceClaims, String targetRealm,
+    public ProcessedClaimCollection mapClaims(String sourceRealm,
+            ProcessedClaimCollection sourceClaims, String targetRealm,
             ClaimsParameters parameters) {
         
-        ClaimCollection targetClaims = new ClaimCollection();
+        ProcessedClaimCollection targetClaims = new ProcessedClaimCollection();
         
-        for (Claim c : sourceClaims) {
-            Claim nc = new Claim();
+        for (ProcessedClaim c : sourceClaims) {
+            ProcessedClaim nc = new ProcessedClaim();
             nc.setClaimType(c.getClaimType());
             nc.setIssuer(c.getIssuer());
             nc.setOriginalIssuer(c.getOriginalIssuer());

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
index 4b8d2db..7c4ae20 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
@@ -37,6 +37,8 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.security.SecurityContext;
 import org.apache.cxf.sts.QNameConstants;
 import org.apache.cxf.sts.STSConstants;
@@ -48,8 +50,6 @@ import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsManager;
 import org.apache.cxf.sts.claims.ClaimsMapper;
 import org.apache.cxf.sts.claims.ClaimsParser;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
 import org.apache.cxf.sts.common.CustomAttributeProvider;
 import org.apache.cxf.sts.common.CustomClaimParser;
 import org.apache.cxf.sts.common.CustomClaimsHandler;
@@ -867,8 +867,8 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection requestedClaims = new RequestClaimCollection();
-        RequestClaim requestClaim = new RequestClaim();
+        ClaimCollection requestedClaims = new ClaimCollection();
+        Claim requestClaim = new Claim();
         requestClaim.setClaimType(ClaimTypes.LASTNAME);
         requestClaim.setOptional(false);
         requestedClaims.add(requestClaim);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
index fe5a236..c0d4f3d 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
@@ -32,11 +32,12 @@ import javax.xml.namespace.QName;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.security.SecurityContext;
 import org.apache.cxf.sts.QNameConstants;
 import org.apache.cxf.sts.STSConstants;
@@ -47,8 +48,6 @@ import org.apache.cxf.sts.claims.ClaimsAttributeStatementProvider;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsManager;
 import org.apache.cxf.sts.claims.ClaimsMapper;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
 import org.apache.cxf.sts.common.CustomAttributeProvider;
 import org.apache.cxf.sts.common.CustomClaimsHandler;
 import org.apache.cxf.sts.common.PasswordCallbackHandler;
@@ -861,8 +860,8 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert
{
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection requestedClaims = new RequestClaimCollection();
-        RequestClaim requestClaim = new RequestClaim();
+        ClaimCollection requestedClaims = new ClaimCollection();
+        Claim requestClaim = new Claim();
         requestClaim.setClaimType(ClaimTypes.LASTNAME);
         requestClaim.setOptional(false);
         requestedClaims.add(requestClaim);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLClaimsTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLClaimsTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLClaimsTest.java
index a3da0a7..af15ad6 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLClaimsTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/SAMLClaimsTest.java
@@ -27,18 +27,17 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.STSConstants;
 import org.apache.cxf.sts.StaticSTSProperties;
 import org.apache.cxf.sts.claims.ClaimTypes;
 import org.apache.cxf.sts.claims.ClaimsAttributeStatementProvider;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsManager;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
 import org.apache.cxf.sts.claims.StaticClaimsHandler;
 import org.apache.cxf.sts.claims.StaticEndpointClaimsHandler;
 import org.apache.cxf.sts.common.CustomAttributeProvider;
@@ -89,7 +88,7 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = createClaims();
+        ClaimCollection claims = createClaims();
         providerParameters.setRequestedPrimaryClaims(claims);
         
         List<AttributeStatementProvider> customProviderList = new ArrayList<AttributeStatementProvider>();
@@ -128,11 +127,11 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection primaryClaims = createClaims();
+        ClaimCollection primaryClaims = createClaims();
         providerParameters.setRequestedPrimaryClaims(primaryClaims);
         
-        RequestClaimCollection secondaryClaims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection secondaryClaims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.STREETADDRESS);
         secondaryClaims.add(claim);
         providerParameters.setRequestedSecondaryClaims(secondaryClaims);
@@ -175,12 +174,12 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection primaryClaims = createClaims();
+        ClaimCollection primaryClaims = createClaims();
         primaryClaims.setDialect(ClaimTypes.URI_BASE);
         providerParameters.setRequestedPrimaryClaims(primaryClaims);
         
-        RequestClaimCollection secondaryClaims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection secondaryClaims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.STREETADDRESS);
         secondaryClaims.add(claim);
         secondaryClaims.setDialect(ClaimTypes.URI_BASE);
@@ -224,8 +223,8 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList((ClaimsHandler)claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(CLAIM_STATIC_COMPANY);
         claims.add(claim);
         providerParameters.setRequestedPrimaryClaims(claims);
@@ -281,8 +280,8 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList((ClaimsHandler)claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(CLAIM_APPLICATION);
         claims.add(claim);
         providerParameters.setRequestedPrimaryClaims(claims);
@@ -340,8 +339,8 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList((ClaimsHandler)claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(CLAIM_APPLICATION);
         claims.add(claim);
         providerParameters.setRequestedPrimaryClaims(claims);
@@ -373,8 +372,8 @@ public class SAMLClaimsTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.MOBILEPHONE);
         claims.add(claim);
         providerParameters.setRequestedPrimaryClaims(claims);
@@ -456,18 +455,18 @@ public class SAMLClaimsTest extends org.junit.Assert {
     /**
      * Create a set of parsed Claims
      */
-    private RequestClaimCollection createClaims() {
-        RequestClaimCollection claims = new RequestClaimCollection();
+    private ClaimCollection createClaims() {
+        ClaimCollection claims = new ClaimCollection();
         
-        RequestClaim claim = new RequestClaim();
+        Claim claim = new Claim();
         claim.setClaimType(ClaimTypes.FIRSTNAME);
         claims.add(claim);
         
-        claim = new RequestClaim();
+        claim = new Claim();
         claim.setClaimType(ClaimTypes.LASTNAME);
         claims.add(claim);
         
-        claim = new RequestClaim();
+        claim = new Claim();
         claim.setClaimType(ClaimTypes.EMAILADDRESS);
         claims.add(claim);
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/realm/RealmSupportTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/realm/RealmSupportTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/realm/RealmSupportTest.java
index 8093c03..2bf239b 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/realm/RealmSupportTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/realm/RealmSupportTest.java
@@ -24,12 +24,12 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsManager;
 import org.apache.cxf.sts.claims.ClaimsParameters;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 import org.apache.cxf.sts.common.RealmSupportClaimsHandler;
 import org.apache.cxf.sts.operation.CustomIdentityMapper;
 import org.apache.wss4j.common.principal.CustomTokenPrincipal;
@@ -63,12 +63,12 @@ public class RealmSupportTest extends org.junit.Assert {
         claimHandlers.add(realmCHandler);
         claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
         
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createClaimCollection();
         
         ClaimsParameters parameters = new ClaimsParameters();
         parameters.setRealm("A");
         parameters.setPrincipal(new CustomTokenPrincipal("alice"));
-        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
+        ProcessedClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims,
parameters);
         Assert.assertEquals("Number of claims incorrect", 3, claims.size());
     }
     
@@ -97,12 +97,12 @@ public class RealmSupportTest extends org.junit.Assert {
         claimHandlers.add(realmCHandler);
         claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
         
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createClaimCollection();
         
         ClaimsParameters parameters = new ClaimsParameters();
         parameters.setRealm("B");
         parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
-        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
+        ProcessedClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims,
parameters);
         Assert.assertEquals("Number of claims incorrect", 3, claims.size());
     }
 
@@ -132,12 +132,12 @@ public class RealmSupportTest extends org.junit.Assert {
         claimHandlers.add(realmCHandler);
         claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
         
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createClaimCollection();
         
         ClaimsParameters parameters = new ClaimsParameters();
         parameters.setRealm("A");
         parameters.setPrincipal(new CustomTokenPrincipal("alice"));
-        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
+        ProcessedClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims,
parameters);
         Assert.assertEquals("Number of claims incorrect", 3, claims.size());
         
         //Asserts in RealmSupportClaimsHandler must succeed
@@ -171,29 +171,29 @@ public class RealmSupportTest extends org.junit.Assert {
         claimHandlers.add(realmCHandler);
         claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
         
-        RequestClaimCollection requestedClaims = createRequestClaimCollection();
+        ClaimCollection requestedClaims = createClaimCollection();
         
         ClaimsParameters parameters = new ClaimsParameters();
         parameters.setRealm("B");
         parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
-        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
+        ProcessedClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims,
parameters);
         Assert.assertEquals("Number of claims incorrect", 2, claims.size());
         
         //Asserts in RealmSupportClaimsHandler must succeed
         
     }
     
-    private RequestClaimCollection createRequestClaimCollection() {
-        RequestClaimCollection requestedClaims = new RequestClaimCollection();
-        RequestClaim requestClaimA = new RequestClaim();
+    private ClaimCollection createClaimCollection() {
+        ClaimCollection requestedClaims = new ClaimCollection();
+        Claim requestClaimA = new Claim();
         requestClaimA.setClaimType(URI.create("Claim-A"));
         requestClaimA.setOptional(false);
         requestedClaims.add(requestClaimA);
-        RequestClaim requestClaimB = new RequestClaim();
+        Claim requestClaimB = new Claim();
         requestClaimB.setClaimType(URI.create("Claim-B"));
         requestClaimB.setOptional(false);
         requestedClaims.add(requestClaimB);
-        RequestClaim requestClaimC = new RequestClaim();
+        Claim requestClaimC = new Claim();
         requestClaimC.setClaimType(URI.create("Claim-C"));
         requestClaimC.setOptional(true);
         requestedClaims.add(requestClaimC);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/validator/SAMLTokenValidatorTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/validator/SAMLTokenValidatorTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/validator/SAMLTokenValidatorTest.java
index 0e8ab23..bfb234e 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/validator/SAMLTokenValidatorTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/validator/SAMLTokenValidatorTest.java
@@ -34,18 +34,17 @@ import javax.security.auth.callback.UnsupportedCallbackException;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.STSConstants;
 import org.apache.cxf.sts.StaticSTSProperties;
 import org.apache.cxf.sts.cache.DefaultInMemoryTokenStore;
 import org.apache.cxf.sts.claims.ClaimsAttributeStatementProvider;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsManager;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
 import org.apache.cxf.sts.common.CustomClaimsHandler;
 import org.apache.cxf.sts.common.PasswordCallbackHandler;
 import org.apache.cxf.sts.request.KeyRequirements;
@@ -535,10 +534,10 @@ public class SAMLTokenValidatorTest extends org.junit.Assert {
         claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
         providerParameters.setClaimsManager(claimsManager);
         
-        RequestClaimCollection claims = new RequestClaimCollection();
-        RequestClaim claim = new RequestClaim();
+        ClaimCollection claims = new ClaimCollection();
+        Claim claim = new Claim();
         claim.setClaimType(URI.create("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role"));
-        claim.setClaimValue(role);
+        claim.addValue(role);
         claims.add(claim);
         
         providerParameters.setRequestedPrimaryClaims(claims);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
index 1780ca1..87ab54f 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomAttributeStatementProvider.java
@@ -23,10 +23,10 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimsManager;
 import org.apache.cxf.sts.claims.ClaimsParameters;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 import org.apache.cxf.sts.token.provider.AttributeStatementProvider;
 import org.apache.cxf.sts.token.provider.TokenProviderParameters;
 import org.apache.wss4j.common.saml.bean.AttributeBean;
@@ -42,7 +42,7 @@ public class CustomAttributeStatementProvider implements AttributeStatementProvi
 
         // Handle Claims
         ClaimsManager claimsManager = providerParameters.getClaimsManager();
-        ClaimCollection retrievedClaims = new ClaimCollection();
+        ProcessedClaimCollection retrievedClaims = new ProcessedClaimCollection();
         if (claimsManager != null) {
             ClaimsParameters params = new ClaimsParameters();
             params.setAdditionalProperties(providerParameters.getAdditionalProperties());
@@ -66,7 +66,7 @@ public class CustomAttributeStatementProvider implements AttributeStatementProvi
             return null;
         }
         
-        Iterator<Claim> claimIterator = retrievedClaims.iterator();
+        Iterator<ProcessedClaim> claimIterator = retrievedClaims.iterator();
         if (!claimIterator.hasNext()) {
             return null;
         }
@@ -76,7 +76,7 @@ public class CustomAttributeStatementProvider implements AttributeStatementProvi
 
         AttributeStatementBean attrBean = new AttributeStatementBean();
         while (claimIterator.hasNext()) {
-            Claim claim = claimIterator.next();
+            ProcessedClaim claim = claimIterator.next();
             AttributeBean attributeBean = new AttributeBean();
             
             URI claimType = claim.getClaimType();

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
index c03e190..d77b355 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsHandler.java
@@ -22,12 +22,12 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.cxf.sts.claims.Claim;
-import org.apache.cxf.sts.claims.ClaimCollection;
+import org.apache.cxf.rt.security.claims.Claim;
+import org.apache.cxf.rt.security.claims.ClaimCollection;
 import org.apache.cxf.sts.claims.ClaimsHandler;
 import org.apache.cxf.sts.claims.ClaimsParameters;
-import org.apache.cxf.sts.claims.RequestClaim;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
+import org.apache.cxf.sts.claims.ProcessedClaim;
+import org.apache.cxf.sts.claims.ProcessedClaimCollection;
 
 /**
  * A custom ClaimsHandler implementation for use in the tests.
@@ -41,13 +41,13 @@ public class CustomClaimsHandler implements ClaimsHandler {
     public static final URI LANGUAGE = 
         URI.create("http://schemas.mycompany.com/claims/language");
     
-    public ClaimCollection retrieveClaimValues(
-            RequestClaimCollection claims, ClaimsParameters parameters) {
+    public ProcessedClaimCollection retrieveClaimValues(
+            ClaimCollection claims, ClaimsParameters parameters) {
       
         if (claims != null && claims.size() > 0) {
-            ClaimCollection claimCollection = new ClaimCollection();
-            for (RequestClaim requestClaim : claims) {
-                Claim claim = new Claim();
+            ProcessedClaimCollection claimCollection = new ProcessedClaimCollection();
+            for (Claim requestClaim : claims) {
+                ProcessedClaim claim = new ProcessedClaim();
                 claim.setClaimType(requestClaim.getClaimType());
                 claim.setIssuer("Test Issuer");
                 claim.setOriginalIssuer("Original Issuer");

http://git-wip-us.apache.org/repos/asf/cxf/blob/db6d5598/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsParser.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsParser.java
b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsParser.java
index 1d0a9e4..ef8314a 100644
--- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsParser.java
+++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/deployment/CustomClaimsParser.java
@@ -21,16 +21,14 @@ package org.apache.cxf.systest.sts.deployment;
 
 import java.net.URI;
 import java.net.URISyntaxException;
-
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.rt.security.claims.Claim;
 import org.apache.cxf.sts.claims.ClaimsParser;
-import org.apache.cxf.sts.claims.RequestClaim;
 
 /**
  * A Custom ClaimsParser implementation.
@@ -42,17 +40,17 @@ public class CustomClaimsParser implements ClaimsParser {
 
     private static final Logger LOG = LogUtils.getL7dLogger(CustomClaimsParser.class);
 
-    public RequestClaim parse(Element claim) {
+    public Claim parse(Element claim) {
         return parseClaimType(claim);
     }
 
-    public static RequestClaim parseClaimType(Element claimType) {
+    public static Claim parseClaimType(Element claimType) {
         String claimLocalName = claimType.getLocalName();
         String claimNS = claimType.getNamespaceURI();
         if ("ClaimType".equals(claimLocalName)) {
             String claimTypeUri = claimType.getAttributeNS(null, "Uri");
             String claimTypeOptional = claimType.getAttributeNS(null, "Optional");
-            RequestClaim requestClaim = new RequestClaim();
+            Claim requestClaim = new Claim();
             try {
                 requestClaim.setClaimType(new URI(claimTypeUri));
             } catch (URISyntaxException e) {
@@ -67,7 +65,7 @@ public class CustomClaimsParser implements ClaimsParser {
         } else if ("ClaimValue".equals(claimLocalName)) {
             String claimTypeUri = claimType.getAttributeNS(null, "Uri");
             String claimTypeOptional = claimType.getAttributeNS(null, "Optional");
-            RequestClaim requestClaim = new RequestClaim();
+            Claim requestClaim = new Claim();
             try {
                 requestClaim.setClaimType(new URI(claimTypeUri));
             } catch (URISyntaxException e) {
@@ -81,7 +79,7 @@ public class CustomClaimsParser implements ClaimsParser {
             Node valueNode = claimType.getFirstChild();
             if (valueNode != null) {
                 if ("Value".equals(valueNode.getLocalName())) {
-                    requestClaim.setClaimValue(valueNode.getTextContent().trim());
+                    requestClaim.addValue(valueNode.getTextContent().trim());
                 } else {
                     LOG.warning("Unsupported child element of ClaimValue element "
                             + valueNode.getLocalName());


Mime
View raw message