Package org.apache.cxf.sts

Examples of org.apache.cxf.sts.IdentityMapper


    }
   
   
    @org.junit.Test
    public void testTwoDistinctMappings() {
        IdentityMapper mapper = new CacheIdentityMapper();
        MemoryIdentityCache cache = new MemoryIdentityCache(mapper);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_C", new CustomTokenPrincipal("user_ccc"), "REALM_D");
        assertEquals(4, cache.size());
View Full Code Here


       
    }
   
    @org.junit.Test
    public void testTwoDistinctAndOneRelatedMapping() {
        IdentityMapper mapper = new CacheIdentityMapper();
        MemoryIdentityCache cache = new MemoryIdentityCache(mapper);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_C", new CustomTokenPrincipal("user_ccc"), "REALM_D");
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_D");
View Full Code Here

        assertEquals(4, cache.get("user_ddd", "REALM_D").size());
    }
   
    @org.junit.Test
    public void testTwoDistinctAndTwoRelatedMapping() {
        IdentityMapper mapper = new CacheIdentityMapper();
        MemoryIdentityCache cache = new MemoryIdentityCache(mapper);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_D", new CustomTokenPrincipal("user_ddd"), "REALM_E");
        assertEquals(4, cache.size());
View Full Code Here

    }
   
    // tests TokenStore apis for storing in the cache.
    @org.junit.Test
    public void testOneMapping() throws Exception {
        IdentityMapper mapper = new CacheIdentityMapper();
        Bus bus = BusFactory.getDefaultBus();
        EHCacheIdentityCache cache = new EHCacheIdentityCache(mapper, bus);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        assertEquals(2, cache.size());
View Full Code Here

    }
   
   
    @org.junit.Test
    public void testTwoDistinctMappings() {
        IdentityMapper mapper = new CacheIdentityMapper();
        Bus bus = BusFactory.getDefaultBus();
        EHCacheIdentityCache cache = new EHCacheIdentityCache(mapper, bus);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_C", new CustomTokenPrincipal("user_ccc"), "REALM_D");
View Full Code Here

        cache.close();
    }
   
    @org.junit.Test
    public void testTwoDistinctAndOneRelatedMapping() {
        IdentityMapper mapper = new CacheIdentityMapper();
        Bus bus = BusFactory.getDefaultBus();
        EHCacheIdentityCache cache = new EHCacheIdentityCache(mapper, bus);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_C", new CustomTokenPrincipal("user_ccc"), "REALM_D");
View Full Code Here

        cache.close();
    }
   
    @org.junit.Test
    public void testTwoDistinctAndTwoRelatedMapping() {
        IdentityMapper mapper = new CacheIdentityMapper();
        Bus bus = BusFactory.getDefaultBus();
        EHCacheIdentityCache cache = new EHCacheIdentityCache(mapper, bus);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        cache.mapPrincipal("REALM_D", new CustomTokenPrincipal("user_ddd"), "REALM_E");
View Full Code Here

                    }
                }
   
                if (relationship == null || relationship.getType().equals(Relationship.FED_TYPE_IDENTITY)) {
                    // federate identity
                    IdentityMapper identityMapper = null;
                    if (relationship == null) {
                        identityMapper = stsProperties.getIdentityMapper();
                    } else {
                        identityMapper = relationship.getIdentityMapper();
                    }
                    if (identityMapper != null) {
                        Principal targetPrincipal =
                            identityMapper.mapPrincipal(sourceRealm, responsePrincipal, targetRealm);
                        validatedToken.setPrincipal(targetPrincipal);
                    } else {
                        LOG.log(Level.SEVERE,
                                "No IdentityMapper configured in STSProperties or Relationship");
                        throw new STSException("Error in providing a token", STSException.REQUEST_FAILED);
View Full Code Here

            // Map the principal (if it exists)
            Principal responsePrincipal = tokenResponse.getPrincipal();
            if (responsePrincipal != null) {
                String targetRealm = providerParameters.getRealm();
                String sourceRealm = tokenResponse.getTokenRealm();
                IdentityMapper identityMapper = stsProperties.getIdentityMapper();
                if (sourceRealm != null && !sourceRealm.equals(targetRealm) && identityMapper != null) {
                    Principal targetPrincipal =
                        identityMapper.mapPrincipal(sourceRealm, responsePrincipal, targetRealm);
                    providerParameters.setPrincipal(targetPrincipal);
                } else {
                    providerParameters.setPrincipal(responsePrincipal);
                }
            }
View Full Code Here

                // Map the principal (if it exists)
                Principal responsePrincipal = tokenResponse.getPrincipal();
                if (responsePrincipal != null) {
                    String targetRealm = providerParameters.getRealm();
                    String sourceRealm = tokenResponse.getTokenRealm();
                    IdentityMapper identityMapper = stsProperties.getIdentityMapper();
                    if (sourceRealm != null && !sourceRealm.equals(targetRealm) && identityMapper != null) {
                        Principal targetPrincipal =
                            identityMapper.mapPrincipal(sourceRealm, responsePrincipal, targetRealm);
                        validateTarget.setPrincipal(targetPrincipal);
                    }
                }
            } else {
                //[TODO] Add plugin for validation out-of-band
View Full Code Here

TOP

Related Classes of org.apache.cxf.sts.IdentityMapper

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.