Package org.apache.cxf.sts.claims

Examples of org.apache.cxf.sts.claims.ClaimCollection


    public static final URI ROLE =
            URI.create("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role");

    public ClaimCollection retrieveClaimValues(Principal principal, RequestClaimCollection claims) {
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                claim.setIssuer("Test Issuer");
                claim.setOriginalIssuer("Original Issuer");
                claim.setValue("admin-user");
                claimCollection.add(claim);
            }
            return claimCollection;
        }
        return null;
    }
View Full Code Here


    public AttributeStatementBean getStatement(TokenProviderParameters providerParameters) {

        // Handle Claims
        ClaimsManager claimsManager = providerParameters.getClaimsManager();
        ClaimCollection retrievedClaims = new ClaimCollection();
        if (claimsManager != null) {
            retrievedClaims =
                claimsManager.retrieveClaimValues(
                    providerParameters.getPrincipal(), providerParameters.getRequestedClaims()
                );
        }

        List<AttributeBean> attributeList = new ArrayList<AttributeBean>();
        String tokenType = providerParameters.getTokenRequirements().getTokenType();

        Iterator<Claim> claimIterator = retrievedClaims.iterator();
        if (!claimIterator.hasNext()) {
            return null;
        }

        AttributeStatementBean attrBean = new AttributeStatementBean();
View Full Code Here

        return knownURIs;
    }

    public ClaimCollection retrieveClaimValues(Principal principal, RequestClaimCollection claims) {
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                    claim.setValue("alice");
                } else if (ClaimTypes.LASTNAME.equals(requestClaim.getClaimType())) {
                    claim.setValue("doe");
                } else if (ClaimTypes.EMAILADDRESS.equals(requestClaim.getClaimType())) {
                    claim.setValue("alice@cxf.apache.org");
                }
                claimCollection.add(claim);
            }
            return claimCollection;
        }
       
        return null;
View Full Code Here

        TokenRequirements tokenRequirements = providerParameters.getTokenRequirements();
        String tokenType = tokenRequirements.getTokenType();
       
        // Handle Claims
        ClaimsManager claimsManager = providerParameters.getClaimsManager();
        ClaimCollection retrievedClaims = new ClaimCollection();
        if (claimsManager != null) {
            retrievedClaims =
                claimsManager.retrieveClaimValues(
                    providerParameters.getPrincipal(), providerParameters.getRequestedClaims()
                );
        }
       
        AttributeStatementBean attrBean = new AttributeStatementBean();
        Iterator<Claim> claimIterator = retrievedClaims.iterator();
        if (!claimIterator.hasNext()) {
            // If no Claims have been processed then create a default attribute
            AttributeBean attributeBean = createDefaultAttribute(tokenType);
            attributeList.add(attributeBean);
        }
View Full Code Here

   
    public ClaimCollection retrieveClaimValues(
            RequestClaimCollection claims, ClaimsParameters parameters) {
     
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                claim.setIssuer("Test Issuer");
                claim.setOriginalIssuer("Original Issuer");
                claim.setValue("admin-user");
                claimCollection.add(claim);
            }
            return claimCollection;
        }
        return null;
    }
View Full Code Here

   
    public ClaimCollection retrieveClaimValues(
            RequestClaimCollection claims, ClaimsParameters parameters) {
     
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                    claim.setValue("alice");
                } else if (ClaimTypes.LASTNAME.equals(requestClaim.getClaimType())) {
                    claim.setValue("doe");
                } else if (ClaimTypes.EMAILADDRESS.equals(requestClaim.getClaimType())) {
                    claim.setValue("alice@cxf.apache.org");
                }
                claimCollection.add(claim);
            }
            return claimCollection;
        }
       
        return null;
View Full Code Here

    @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;
View Full Code Here

   
    public ClaimCollection retrieveClaimValues(
            RequestClaimCollection claims, ClaimsParameters parameters) {
     
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                claim.setIssuer("Test Issuer");
                claim.setOriginalIssuer("Original Issuer");
                claim.setValue("admin-user");
                claimCollection.add(claim);
            }
            return claimCollection;
        }
        return null;
    }
View Full Code Here

   
    public ClaimCollection retrieveClaimValues(
            RequestClaimCollection claims, ClaimsParameters parameters) {
     
        if (claims != null && claims.size() > 0) {
            ClaimCollection claimCollection = new ClaimCollection();
            for (RequestClaim requestClaim : claims) {
                Claim claim = new Claim();
                claim.setClaimType(requestClaim.getClaimType());
                if (ClaimTypes.FIRSTNAME.equals(requestClaim.getClaimType())) {
                    if (requestClaim instanceof CustomRequestClaim) {
                        CustomRequestClaim customClaim = (CustomRequestClaim) requestClaim;
                        String customName = customClaim.getClaimValue() + "@" + customClaim.getScope();
                        claim.setValue(customName);
                    } else {
                        claim.setValue("alice");
                    }
                } else if (ClaimTypes.LASTNAME.equals(requestClaim.getClaimType())) {
                    claim.setValue("doe");
                } else if (ClaimTypes.EMAILADDRESS.equals(requestClaim.getClaimType())) {
                    claim.setValue("alice@cxf.apache.org");
                } else if (ROLE_CLAIM.equals(requestClaim.getClaimType())) {
                    String requestedRole = requestClaim.getClaimValue();
                    if (isUserInRole(parameters.getPrincipal(), requestedRole)) {
                        claim.setValue(requestedRole);
                    } else {
                        continue;
                    }
                }               
                claimCollection.add(claim);
            }
            return claimCollection;
        }
       
        return null;
View Full Code Here

    public AttributeStatementBean getStatement(TokenProviderParameters providerParameters) {

        // Handle Claims
        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.getRequestedClaims(),
                    params
                );
        }
        if (retrievedClaims == null) {
            return null;
        }
       
        Iterator<Claim> claimIterator = retrievedClaims.iterator();
        if (!claimIterator.hasNext()) {
            return null;
        }

        List<AttributeBean> attributeList = new ArrayList<AttributeBean>();
View Full Code Here

TOP

Related Classes of org.apache.cxf.sts.claims.ClaimCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.