cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1232076 - 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/ldap/ systests/advanced/src/test/java/org/apache/cxf/systes...
Date Mon, 16 Jan 2012 17:42:35 GMT
Author: owulff
Date: Mon Jan 16 17:42:34 2012
New Revision: 1232076

URL: http://svn.apache.org/viewvc?rev=1232076&view=rev
Log:
Method added for ClaimsHandler/ClaimsManager to pass more context data

Added:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
Modified:
    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/ClaimsHandler.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/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/ldap/LDAPClaimsTest.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/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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -38,12 +38,21 @@ public class ClaimsAttributeStatementPro
         ClaimsManager claimsManager = providerParameters.getClaimsManager();
         ClaimCollection retrievedClaims = new ClaimCollection();
         if (claimsManager != null) {
+            ClaimsParameters params = new ClaimsParameters();
+            params.setAdditionalProperties(providerParameters.getAdditionalProperties());
+            params.setAppliesToAddress(providerParameters.getAppliesToAddress());
+            params.setEncryptionProperties(providerParameters.getEncryptionProperties());
+            params.setKeyRequirements(providerParameters.getKeyRequirements());
+            params.setPrincipal(providerParameters.getPrincipal());
+            params.setRealm(providerParameters.getRealm());
+            params.setStsProperties(providerParameters.getStsProperties());
+            params.setTokenRequirements(providerParameters.getTokenRequirements());
+            params.setTokenStore(providerParameters.getTokenStore());
+            params.setWebServiceContext(providerParameters.getWebServiceContext());
             retrievedClaims = 
                 claimsManager.retrieveClaimValues(
-                    providerParameters.getPrincipal(),
                     providerParameters.getRequestedClaims(),
-                    providerParameters.getWebServiceContext(),
-                    providerParameters.getRealm()
+                    params
                 );
         }
         if (retrievedClaims == null) {

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsHandler.java?rev=1232076&r1=1232075&r2=1232076&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsHandler.java
Mon Jan 16 17:42:34 2012
@@ -32,8 +32,11 @@ public interface ClaimsHandler {
 
     List<URI> getSupportedClaimTypes();
 
+    @Deprecated
     ClaimCollection retrieveClaimValues(
             Principal principal, RequestClaimCollection claims, WebServiceContext context,
String realm);
 
+    ClaimCollection retrieveClaimValues(RequestClaimCollection claims, ClaimsParameters parameters);
+
 }
  
\ No newline at end of file

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -23,14 +23,20 @@ import java.net.URI;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Logger;
 
 import javax.xml.ws.WebServiceContext;
 
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.security.sts.provider.STSException;
+
 /**
  * This class holds various ClaimsHandler implementations.
  */
 public class ClaimsManager {
-        
+
+    private static final Logger LOG = LogUtils.getL7dLogger(ClaimsManager.class);
+
     private List<ClaimsHandler> claimHandlers;
     private List<URI> supportedClaimTypes = new ArrayList<URI>();
 
@@ -53,6 +59,7 @@ public class ClaimsManager {
         }
     }
 
+    @Deprecated
     public ClaimCollection retrieveClaimValues(
             Principal principal, RequestClaimCollection claims, WebServiceContext context,
String realm) {
         if (claimHandlers != null && claimHandlers.size() > 0 && claims
!= null && claims.size() > 0) {
@@ -64,9 +71,49 @@ public class ClaimsManager {
                     returnCollection.addAll(claimCollection);
                 }
             }
+            validateClaimValues(claims, returnCollection);
             return returnCollection;
         }
         return null;
     }
+    
+    public ClaimCollection retrieveClaimValues(RequestClaimCollection claims, ClaimsParameters
parameters) {
+        if (claimHandlers != null && claimHandlers.size() > 0 && claims
!= null && claims.size() > 0) {
+            ClaimCollection returnCollection = new ClaimCollection();
+            for (ClaimsHandler handler : claimHandlers) {
+                ClaimCollection claimCollection = handler.retrieveClaimValues(claims, parameters);
+                if (claimCollection != null && claimCollection.size() != 0) {
+                    returnCollection.addAll(claimCollection);
+                }
+            }
+            validateClaimValues(claims, returnCollection);
+            return returnCollection;
+        }
+        return null;
+    }
+    
+    private boolean validateClaimValues(RequestClaimCollection requestedClaims, ClaimCollection
claims) {
+        for (RequestClaim claim : requestedClaims) {
+            URI claimType = claim.getClaimType();
+            boolean found = false;
+            if (!claim.isOptional()) {
+                for (Claim c : claims) {
+                    if (c.getClaimType().equals(claimType)) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    LOG.warning("Mandatory claim not found: " + claim.getClaimType());
+                    throw new STSException("Mandatory claim '" + claim.getClaimType() + "'
not found");
+                }
+            }
+        }
+        return true;
+        
+    }
+    
+    
 
 }
+ 
\ No newline at end of file

Added: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java?rev=1232076&view=auto
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
(added)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParameters.java
Mon Jan 16 17:42:34 2012
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.sts.claims;
+
+
+import java.security.Principal;
+import java.util.Map;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.sts.STSPropertiesMBean;
+import org.apache.cxf.sts.cache.STSTokenStore;
+import org.apache.cxf.sts.request.KeyRequirements;
+import org.apache.cxf.sts.request.TokenRequirements;
+import org.apache.cxf.sts.service.EncryptionProperties;
+
+/**
+ * This class encapsulates the parameters that will be passed to a ClaimsHandler instance
to
+ * to retrieve claims. It consists of both parameters that have been extracted from the request,
+ * as well as configuration specific to the STS itself.
+ */
+public class ClaimsParameters {
+
+    private STSPropertiesMBean stsProperties;
+    private EncryptionProperties encryptionProperties;
+    private Principal principal;
+    private WebServiceContext webServiceContext;
+    private KeyRequirements keyRequirements;
+    private TokenRequirements tokenRequirements;
+    private String appliesToAddress;
+    private Map<String, Object> additionalProperties;
+    private STSTokenStore tokenStore;
+    private String realm;
+    
+    public STSTokenStore getTokenStore() {
+        return tokenStore;
+    }
+
+    public void setTokenStore(STSTokenStore tokenStore) {
+        this.tokenStore = tokenStore;
+    }
+        
+    public String getAppliesToAddress() {
+        return appliesToAddress;
+    }
+
+    public void setAppliesToAddress(String appliesToAddress) {
+        this.appliesToAddress = appliesToAddress;
+    }
+
+    public TokenRequirements getTokenRequirements() {
+        return tokenRequirements;
+    }
+
+    public void setTokenRequirements(TokenRequirements tokenRequirements) {
+        this.tokenRequirements = tokenRequirements;
+    }
+    
+    public KeyRequirements getKeyRequirements() {
+        return keyRequirements;
+    }
+
+    public void setKeyRequirements(KeyRequirements keyRequirements) {
+        this.keyRequirements = keyRequirements;
+    }
+
+    public STSPropertiesMBean getStsProperties() {
+        return stsProperties;
+    }
+
+    public void setStsProperties(STSPropertiesMBean stsProperties) {
+        this.stsProperties = stsProperties;
+    }
+    
+    public EncryptionProperties getEncryptionProperties() {
+        return encryptionProperties;
+    }
+
+    public void setEncryptionProperties(EncryptionProperties encryptionProperties) {
+        this.encryptionProperties = encryptionProperties;
+    }
+    
+    public WebServiceContext getWebServiceContext() {
+        return webServiceContext;
+    }
+
+    public void setWebServiceContext(WebServiceContext webServiceContext) {
+        this.webServiceContext = webServiceContext;
+    }
+    
+    public void setPrincipal(Principal principal) {
+        this.principal = principal;
+    }
+    
+    public Principal getPrincipal() {
+        return principal;
+    }
+    
+    public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+        this.additionalProperties = additionalProperties;
+    }
+    
+    public Map<String, Object> getAdditionalProperties() {
+        return additionalProperties;
+    }
+    
+    public void setRealm(String realm) {
+        this.realm = realm;
+    }
+    
+    public String getRealm() {
+        return realm;
+    }
+    
+}
+

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -41,7 +41,6 @@ import javax.xml.ws.WebServiceContext;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.ws.security.sts.provider.STSException;
 import org.springframework.ldap.core.AttributesMapper;
 import org.springframework.ldap.core.LdapTemplate;
 import org.springframework.ldap.filter.AndFilter;
@@ -130,9 +129,24 @@ public class LdapClaimsHandler implement
         return uriList;
     }
 
+    @Deprecated
     public ClaimCollection retrieveClaimValues(
             Principal principal, RequestClaimCollection claims, WebServiceContext context,
String realm) {
-
+        
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(principal);
+        params.setWebServiceContext(context);
+        params.setRealm(realm);
+        
+        return retrieveClaimValues(claims, params);
+    }
+    
+    
+    public ClaimCollection retrieveClaimValues(
+            RequestClaimCollection claims, ClaimsParameters parameters) {
+      
+        Principal principal = parameters.getPrincipal();
+        
         String user = null;
         if (principal instanceof KerberosPrincipal) {
             KerberosPrincipal kp = (KerberosPrincipal)principal;
@@ -154,8 +168,8 @@ public class LdapClaimsHandler implement
             LOG.warning("User must not be null");
             return new ClaimCollection();
         } else {
-            if (LOG.isLoggable(Level.FINE)) {
-                LOG.fine("Retrieve claims for user " + user);
+            if (LOG.isLoggable(Level.FINEST)) {
+                LOG.finest("Retrieve claims for user " + user);
             }
         }
         
@@ -171,7 +185,9 @@ public class LdapClaimsHandler implement
                     getClaimsLdapAttributeMapping().get(claim.getClaimType().toString())
                 );
             } else {
-                LOG.warning("Unsupported claim: " + claim.getClaimType());
+                if (LOG.isLoggable(Level.FINER)) {
+                    LOG.finer("Unsupported claim: " + claim.getClaimType());
+                }
             }
         }
 
@@ -207,11 +223,8 @@ public class LdapClaimsHandler implement
             String ldapAttribute = getClaimsLdapAttributeMapping().get(claimType.toString());
             Attribute attr = ldapAttributes.get(ldapAttribute);
             if (attr == null) {
-                if (!claim.isOptional()) {
-                    LOG.warning("Mandatory claim not found in LDAP: " + claim.getClaimType());
-                    throw new STSException("Mandatory claim '" + claim.getClaimType() + "'
not found");
-                } else {
-                    LOG.fine("Claim '" + claim.getClaimType() + "' is null");
+                if (LOG.isLoggable(Level.FINEST)) {
+                    LOG.finest("Claim '" + claim.getClaimType() + "' is null");
                 }
             } else {
                 Claim c = new Claim();

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -28,6 +28,7 @@ import org.w3c.dom.Element;
 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.request.ReceivedToken;
 import org.apache.cxf.sts.request.TokenRequirements;
 import org.apache.cxf.sts.token.provider.AttributeStatementProvider;
@@ -59,12 +60,21 @@ public class CustomAttributeProvider imp
         ClaimsManager claimsManager = providerParameters.getClaimsManager();
         ClaimCollection retrievedClaims = new ClaimCollection();
         if (claimsManager != null) {
+            ClaimsParameters params = new ClaimsParameters();
+            params.setAdditionalProperties(providerParameters.getAdditionalProperties());
+            params.setAppliesToAddress(providerParameters.getAppliesToAddress());
+            params.setEncryptionProperties(providerParameters.getEncryptionProperties());
+            params.setKeyRequirements(providerParameters.getKeyRequirements());
+            params.setPrincipal(providerParameters.getPrincipal());
+            params.setRealm(providerParameters.getRealm());
+            params.setStsProperties(providerParameters.getStsProperties());
+            params.setTokenRequirements(providerParameters.getTokenRequirements());
+            params.setTokenStore(providerParameters.getTokenStore());
+            params.setWebServiceContext(providerParameters.getWebServiceContext());
             retrievedClaims = 
                 claimsManager.retrieveClaimValues(
-                    providerParameters.getPrincipal(),
                     providerParameters.getRequestedClaims(),
-                    providerParameters.getWebServiceContext(),
-                    providerParameters.getRealm()
+                    params
                 );
         }
         

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -29,6 +29,7 @@ import org.apache.cxf.sts.claims.Claim;
 import org.apache.cxf.sts.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;
 
@@ -49,8 +50,22 @@ public class CustomClaimsHandler impleme
         return knownURIs;
     }
 
+    @Deprecated
     public ClaimCollection retrieveClaimValues(
             Principal principal, RequestClaimCollection claims, WebServiceContext context,
String realm) {
+        
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(principal);
+        params.setWebServiceContext(context);
+        params.setRealm(realm);
+        
+        return retrieveClaimValues(claims, params);
+    }
+    
+    
+    public ClaimCollection retrieveClaimValues(
+            RequestClaimCollection claims, ClaimsParameters parameters) {
+      
         if (claims != null && claims.size() > 0) {
             ClaimCollection claimCollection = new ClaimCollection();
             for (RequestClaim requestClaim : claims) {

Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java?rev=1232076&r1=1232075&r2=1232076&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/LDAPClaimsTest.java
Mon Jan 16 17:42:34 2012
@@ -37,6 +37,7 @@ import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.sts.claims.Claim;
 import org.apache.cxf.sts.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;
@@ -88,9 +89,11 @@ public class LDAPClaimsTest {
         expectedClaims.add(ClaimTypes.FIRSTNAME);
         expectedClaims.add(ClaimTypes.LASTNAME);
         expectedClaims.add(ClaimTypes.EMAILADDRESS);
-
+       
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(new CustomTokenPrincipal(user));
         ClaimCollection retrievedClaims = 
-            claimsHandler.retrieveClaimValues(new CustomTokenPrincipal(user), requestedClaims,
null, null);
+            claimsHandler.retrieveClaimValues(requestedClaims, params);
 
         Assert.isTrue(
                       retrievedClaims.size() == expectedClaims.size(), 
@@ -124,8 +127,9 @@ public class LDAPClaimsTest {
         claim.setOptional(false);
         requestedClaims.add(claim);
 
-        claimsHandler.retrieveClaimValues(new CustomTokenPrincipal(user), requestedClaims,
null, null);
-
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(new CustomTokenPrincipal(user));
+        claimsHandler.retrieveClaimValues(requestedClaims, params);
     }
 
     @org.junit.Test
@@ -148,9 +152,11 @@ public class LDAPClaimsTest {
         expectedClaims.add(ClaimTypes.FIRSTNAME);
         expectedClaims.add(ClaimTypes.LASTNAME);
         expectedClaims.add(ClaimTypes.EMAILADDRESS);
-
+        
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(new CustomTokenPrincipal(user));
         ClaimCollection retrievedClaims = 
-            claimsHandler.retrieveClaimValues(new CustomTokenPrincipal(user), requestedClaims,
null, null);
+            claimsHandler.retrieveClaimValues(requestedClaims, params);
 
         Assert.isTrue(
                       retrievedClaims.size() == expectedClaims.size(), 

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -27,6 +27,7 @@ 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.token.provider.AttributeStatementProvider;
 import org.apache.cxf.sts.token.provider.TokenProviderParameters;
 import org.apache.ws.security.WSConstants;
@@ -41,12 +42,21 @@ public class CustomAttributeStatementPro
         ClaimsManager claimsManager = providerParameters.getClaimsManager();
         ClaimCollection retrievedClaims = new ClaimCollection();
         if (claimsManager != null) {
+            ClaimsParameters params = new ClaimsParameters();
+            params.setAdditionalProperties(providerParameters.getAdditionalProperties());
+            params.setAppliesToAddress(providerParameters.getAppliesToAddress());
+            params.setEncryptionProperties(providerParameters.getEncryptionProperties());
+            params.setKeyRequirements(providerParameters.getKeyRequirements());
+            params.setPrincipal(providerParameters.getPrincipal());
+            params.setRealm(providerParameters.getRealm());
+            params.setStsProperties(providerParameters.getStsProperties());
+            params.setTokenRequirements(providerParameters.getTokenRequirements());
+            params.setTokenStore(providerParameters.getTokenStore());
+            params.setWebServiceContext(providerParameters.getWebServiceContext());
             retrievedClaims = 
                 claimsManager.retrieveClaimValues(
-                    providerParameters.getPrincipal(),
                     providerParameters.getRequestedClaims(),
-                    providerParameters.getWebServiceContext(),
-                    providerParameters.getRealm()
+                    params
                 );
         }
         if (retrievedClaims == null) {

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=1232076&r1=1232075&r2=1232076&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
Mon Jan 16 17:42:34 2012
@@ -28,6 +28,7 @@ import javax.xml.ws.WebServiceContext;
 import org.apache.cxf.sts.claims.Claim;
 import org.apache.cxf.sts.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;
 
@@ -39,8 +40,22 @@ public class CustomClaimsHandler impleme
     public static final URI ROLE = 
             URI.create("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");
 
+    @Deprecated
     public ClaimCollection retrieveClaimValues(
             Principal principal, RequestClaimCollection claims, WebServiceContext context,
String realm) {
+        
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(principal);
+        params.setWebServiceContext(context);
+        params.setRealm(realm);
+        
+        return retrieveClaimValues(claims, params);
+    }
+    
+    
+    public ClaimCollection retrieveClaimValues(
+            RequestClaimCollection claims, ClaimsParameters parameters) {
+      
         if (claims != null && claims.size() > 0) {
             ClaimCollection claimCollection = new ClaimCollection();
             for (RequestClaim requestClaim : claims) {



Mime
View raw message