cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1325634 - in /cxf/sandbox/fediz/fediz-idp-sts: pom.xml src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java
Date Fri, 13 Apr 2012 07:22:32 GMT
Author: owulff
Date: Fri Apr 13 07:22:31 2012
New Revision: 1325634

URL: http://svn.apache.org/viewvc?rev=1325634&view=rev
Log:
migrated STS to CXF version 2.5.2

Modified:
    cxf/sandbox/fediz/fediz-idp-sts/pom.xml
    cxf/sandbox/fediz/fediz-idp-sts/src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java

Modified: cxf/sandbox/fediz/fediz-idp-sts/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/fediz/fediz-idp-sts/pom.xml?rev=1325634&r1=1325633&r2=1325634&view=diff
==============================================================================
--- cxf/sandbox/fediz/fediz-idp-sts/pom.xml (original)
+++ cxf/sandbox/fediz/fediz-idp-sts/pom.xml Fri Apr 13 07:22:31 2012
@@ -13,7 +13,7 @@
     <packaging>war</packaging>
 
    <properties>
-      <cxf.version>2.5.1</cxf.version>
+      <cxf.version>2.5.2</cxf.version>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
 

Modified: cxf/sandbox/fediz/fediz-idp-sts/src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/fediz/fediz-idp-sts/src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java?rev=1325634&r1=1325633&r2=1325634&view=diff
==============================================================================
--- cxf/sandbox/fediz/fediz-idp-sts/src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java
(original)
+++ cxf/sandbox/fediz/fediz-idp-sts/src/main/java/org/apache/cxf/fediz/service/sts/FileClaimsHandler.java
Fri Apr 13 07:22:31 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;
 
@@ -38,46 +39,27 @@ import org.apache.cxf.sts.claims.Request
 public class FileClaimsHandler implements ClaimsHandler {
 
     public static final URI ROLE = 
-            URI.create("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");
+        URI.create("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");
 
     private Map<String,Map<String,String>> userClaims = null;
-    
+
     public void setUserClaims(Map<String,Map<String,String>> userClaims) {
-		this.userClaims = userClaims;
-	}
+        this.userClaims = userClaims;
+    }
+
+    public Map<String,Map<String,String>> getUserClaims() {
+        return userClaims;
+    }
 
-	public Map<String,Map<String,String>> getUserClaims() {
-		return userClaims;
-	}
-    
     @Override
     public ClaimCollection retrieveClaimValues(Principal principal, RequestClaimCollection
claims, WebServiceContext context, String realm) {
-    	
-    	if (getUserClaims() == null) {
-    		return new ClaimCollection();
-    	}
-    	
-    	Map<String, String> claimMap = getUserClaims().get(principal.getName());
-    	if (claimMap == null || claimMap.size() == 0) {
-    		return new ClaimCollection();
-    	}
-    	    	
-        if (claims != null && claims.size() > 0) {
-            ClaimCollection claimCollection = new ClaimCollection();
-            for (RequestClaim requestClaim : claims) { 
-            	String claimValue = claimMap.get(requestClaim.getClaimType().toString());
-            	if (claimValue != null) {
-	            	Claim claim = new Claim();
-	                claim.setClaimType(requestClaim.getClaimType());
-	                claim.setIssuer("Test Issuer");
-	                claim.setOriginalIssuer("Original Issuer");
-	                claim.setValue(claimValue);
-	                claimCollection.add(claim);
-            	}   
-            }
-            return claimCollection;
-        }
-        return null;
+
+        ClaimsParameters params = new ClaimsParameters();
+        params.setPrincipal(principal);
+        params.setWebServiceContext(context);
+        params.setRealm(realm);
+
+        return this.retrieveClaimValues(claims, params);
     }
 
     @Override
@@ -90,6 +72,42 @@ public class FileClaimsHandler implement
         return list;
     }
 
-	
+    @Override
+    public ClaimCollection retrieveClaimValues(RequestClaimCollection claims,
+            ClaimsParameters parameters) {
+
+        if (getUserClaims() == null) {
+            return new ClaimCollection();
+        }
+
+        if (claims == null || claims.size() == 0) {
+            return new ClaimCollection();
+        }
+
+        Map<String, String> claimMap = getUserClaims().get(parameters.getPrincipal().getName());
+        if (claimMap == null || claimMap.size() == 0) {
+            return new ClaimCollection();
+        }
+
+        if (claims != null && claims.size() > 0) {
+            ClaimCollection claimCollection = new ClaimCollection();
+            for (RequestClaim requestClaim : claims) { 
+                String claimValue = claimMap.get(requestClaim.getClaimType().toString());
+                if (claimValue != null) {
+                    Claim claim = new Claim();
+                    claim.setClaimType(requestClaim.getClaimType());
+                    claim.setIssuer("Test Issuer");
+                    claim.setOriginalIssuer("Original Issuer");
+                    claim.setValue(claimValue);
+                    claimCollection.add(claim);
+                }   
+            }
+            return claimCollection;
+        }
+        return null;
+
+    }
+
+
 
 }



Mime
View raw message