Package org.apache.cxf.sts.claims

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


    private String nameFormat = SAML2Constants.ATTRNAME_FORMAT_UNSPECIFIED;

    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.getRequestedPrimaryClaims(),
                    providerParameters.getRequestedSecondaryClaims(),
                    params
                );
        }
View Full Code Here


   
    @org.junit.Test
    public void testIdentityMappingRealmA2B() throws Exception {
       
        ClaimsManager claimsManager = new ClaimsManager();
       
        claimsManager.setIdentityMapper(new CustomIdentityMapper());
       
        RealmSupportClaimsHandler realmAHandler = new RealmSupportClaimsHandler();
        realmAHandler.setRealm("A");
        realmAHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-A")));
       
        RealmSupportClaimsHandler realmBHandler = new RealmSupportClaimsHandler();
        realmBHandler.setRealm("B");
        realmBHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-B")));
       
        RealmSupportClaimsHandler realmCHandler = new RealmSupportClaimsHandler();
        realmCHandler.setRealm("B");
        realmCHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-C")));
       
        List<ClaimsHandler> claimHandlers = new ArrayList<ClaimsHandler>();
        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("A");
        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
        Assert.assertEquals("Number of claims incorrect", 3, claims.size());
    }
View Full Code Here

    }
   
    @org.junit.Test
    public void testIdentityMappingRealmB2A() throws Exception {
       
        ClaimsManager claimsManager = new ClaimsManager();
       
        claimsManager.setIdentityMapper(new CustomIdentityMapper());
       
        RealmSupportClaimsHandler realmAHandler = new RealmSupportClaimsHandler();
        realmAHandler.setRealm("A");
        realmAHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-A")));
       
        RealmSupportClaimsHandler realmBHandler = new RealmSupportClaimsHandler();
        realmBHandler.setRealm("B");
        realmBHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-B")));
       
        RealmSupportClaimsHandler realmCHandler = new RealmSupportClaimsHandler();
        realmCHandler.setRealm("B");
        realmCHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-C")));
       
        List<ClaimsHandler> claimHandlers = new ArrayList<ClaimsHandler>();
        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("B");
        parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
        Assert.assertEquals("Number of claims incorrect", 3, claims.size());
    }
View Full Code Here

    }

    @org.junit.Test
    public void testFilteredRealmAIdentityMapping() throws Exception {
       
        ClaimsManager claimsManager = new ClaimsManager();
       
        claimsManager.setIdentityMapper(new CustomIdentityMapper());
       
        RealmSupportClaimsHandler realmAHandler = new RealmSupportClaimsHandler();
        realmAHandler.setRealm("A");
        realmAHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-A")));
       
        RealmSupportClaimsHandler realmBHandler = new RealmSupportClaimsHandler();
        realmBHandler.setRealm("B");
        realmBHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-B")));
       
        RealmSupportClaimsHandler realmCHandler = new RealmSupportClaimsHandler();
        realmCHandler.setRealm("A");
        realmCHandler.setSupportedRealms(Collections.singletonList("A"));
        realmCHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-C")));
       
        List<ClaimsHandler> claimHandlers = new ArrayList<ClaimsHandler>();
        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("A");
        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
        Assert.assertEquals("Number of claims incorrect", 3, claims.size());
       
        //Asserts in RealmSupportClaimsHandler must succeed
       
    }
View Full Code Here

   
   
    @org.junit.Test
    public void testFilteredRealmBIdentityMapping() throws Exception {
       
        ClaimsManager claimsManager = new ClaimsManager();
       
        claimsManager.setIdentityMapper(new CustomIdentityMapper());
       
        RealmSupportClaimsHandler realmAHandler = new RealmSupportClaimsHandler();
        realmAHandler.setRealm("A");
        realmAHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-A")));
       
        RealmSupportClaimsHandler realmBHandler = new RealmSupportClaimsHandler();
        realmBHandler.setRealm("B");
        realmBHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-B")));
       
        RealmSupportClaimsHandler realmCHandler = new RealmSupportClaimsHandler();
        realmCHandler.setRealm("A");
        realmCHandler.setSupportedRealms(Collections.singletonList("A"));
        realmCHandler.setSupportedClaimTypes(Collections.singletonList(URI.create("Claim-C")));
       
        List<ClaimsHandler> claimHandlers = new ArrayList<ClaimsHandler>();
        claimHandlers.add(realmAHandler);
        claimHandlers.add(realmBHandler);
        claimHandlers.add(realmCHandler);
        claimsManager.setClaimHandlers(Collections.unmodifiableList(claimHandlers));
       
        RequestClaimCollection requestedClaims = createRequestClaimCollection();
       
        ClaimsParameters parameters = new ClaimsParameters();
        parameters.setRealm("B");
        parameters.setPrincipal(new CustomTokenPrincipal("ALICE"));
        ClaimCollection claims = claimsManager.retrieveClaimValues(requestedClaims, parameters);
        Assert.assertEquals("Number of claims incorrect", 2, claims.size());
       
        //Asserts in RealmSupportClaimsHandler must succeed
       
    }
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) {
            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.getRequestedPrimaryClaims(),
                    providerParameters.getRequestedSecondaryClaims(),
                    params
                );
        }
View Full Code Here

        addService(issueOperation);
       
        addSTSProperties(issueOperation);
       
        // Set the ClaimsManager
        ClaimsManager claimsManager = new ClaimsManager();
        ClaimsHandler claimsHandler = new CustomClaimsHandler();
        claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
        issueOperation.setClaimsManager(claimsManager);
       
        // Mock up a request
        RequestSecurityTokenType request = new RequestSecurityTokenType();
        JAXBElement<String> tokenType =
View Full Code Here

       
        // Add STSProperties object
        addSTSProperties(issueOperation);
       
        // Set the ClaimsManager
        ClaimsManager claimsManager = new ClaimsManager();
        ClaimsHandler claimsHandler = new CustomClaimsHandler();
        claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
        issueOperation.setClaimsManager(claimsManager);
       
        // Mock up a request
        RequestSecurityTokenType request = new RequestSecurityTokenType();
        JAXBElement<String> tokenType =
View Full Code Here

       
        // Add STSProperties object
        addSTSProperties(issueOperation);
       
        // Set the ClaimsManager
        ClaimsManager claimsManager = new ClaimsManager();
        ClaimsHandler claimsHandler = new CustomClaimsHandler();
        ClaimsParser claimsParser = new CustomClaimParser();
        claimsManager.setClaimParsers(Collections.singletonList(claimsParser));
        claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
        issueOperation.setClaimsManager(claimsManager);
       
        // Mock up a request
        RequestSecurityTokenType request = new RequestSecurityTokenType();
        JAXBElement<String> tokenType =
View Full Code Here

        addService(issueOperation);
       
        addSTSProperties(issueOperation);
       
        // Set the ClaimsManager
        ClaimsManager claimsManager = new ClaimsManager();
        ClaimsHandler claimsHandler = new CustomClaimsHandler();
        claimsManager.setClaimHandlers(Collections.singletonList(claimsHandler));
        issueOperation.setClaimsManager(claimsManager);
       
        // Mock up a request
        RequestSecurityTokenType request = new RequestSecurityTokenType();
        JAXBElement<String> tokenType =
View Full Code Here

TOP

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

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.