Examples of CustomTokenPrincipal


Examples of org.apache.ws.security.CustomTokenPrincipal

        }
        String targetUser = identities.get(targetRealm);
        if (targetUser == null) {
            return null;
        }
        return new CustomTokenPrincipal(targetUser);
       
    }
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

    @org.junit.Test
    public void testOneMapping() throws Exception {
        IdentityMapper mapper = new CacheIdentityMapper();
        MemoryIdentityCache cache = new MemoryIdentityCache(mapper);
       
        cache.mapPrincipal("REALM_A", new CustomTokenPrincipal("user_aaa"), "REALM_B");
        assertEquals(2, cache.size());
        assertNotNull(cache.get("user_aaa", "REALM_A"));
        assertNotNull(cache.get("user_bbb", "REALM_B"));
    }
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

    @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());
        assertNotNull(cache.get("user_aaa", "REALM_A"));
        assertNotNull(cache.get("user_bbb", "REALM_B"));
        assertNotNull(cache.get("user_ccc", "REALM_C"));
        assertNotNull(cache.get("user_ddd", "REALM_D"));
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

    @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");
        //now, mapping from A -> D and B -> D are cached as well
        assertEquals(4, cache.size());
        assertNotNull(cache.get("user_aaa", "REALM_A"));
        assertNotNull(cache.get("user_bbb", "REALM_B"));
        assertNotNull(cache.get("user_ccc", "REALM_C"));
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

    @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());
        //No Mapping occured between A,B and D,E (C not involved at all)
        assertEquals(2, cache.get("user_aaa", "REALM_A").size());
        assertEquals(2, cache.get("user_bbb", "REALM_B").size());
        assertEquals(2, cache.get("user_ddd", "REALM_D").size());
        assertEquals(2, cache.get("user_eee", "REALM_E").size());
       
        cache.mapPrincipal("REALM_B", new CustomTokenPrincipal("user_bbb"), "REALM_C");
        assertEquals(5, cache.size());
        assertNotNull(cache.get("user_aaa", "REALM_A"));
        assertNotNull(cache.get("user_bbb", "REALM_B"));
        assertNotNull(cache.get("user_ccc", "REALM_C"));
        assertNotNull(cache.get("user_ddd", "REALM_D"));
        assertNotNull(cache.get("user_eee", "REALM_E"));
        assertEquals(3, cache.get("user_aaa", "REALM_A").size());
        assertEquals(3, cache.get("user_bbb", "REALM_B").size());
        assertEquals(3, cache.get("user_ccc", "REALM_C").size());
        //No mapping occurred between A,B,C and D,E -> distinct
        assertEquals(2, cache.get("user_ddd", "REALM_D").size());
        assertEquals(2, cache.get("user_eee", "REALM_E").size());
       
        cache.mapPrincipal("REALM_C", new CustomTokenPrincipal("user_ccc"), "REALM_E");
        //All mappings are known now
        assertEquals(5, cache.size());
        assertNotNull(cache.get("user_aaa", "REALM_A"));
        assertNotNull(cache.get("user_bbb", "REALM_B"));
        assertNotNull(cache.get("user_ccc", "REALM_C"));
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

        parameters.setTokenRequirements(tokenRequirements);
       
        KeyRequirements keyRequirements = new KeyRequirements();
        parameters.setKeyRequirements(keyRequirements);
       
        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        // Mock up message context
        MessageImpl msg = new MessageImpl();
        WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
        WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
        parameters.setWebServiceContext(webServiceContext);
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

        KeyRequirements keyRequirements = new KeyRequirements();
        keyRequirements.setKeyType(keyType);
        parameters.setKeyRequirements(keyRequirements);

        parameters.setPrincipal(new CustomTokenPrincipal("alice"));
        // Mock up message context
        MessageImpl msg = new MessageImpl();
        WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
        WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
        parameters.setWebServiceContext(webServiceContext);
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

        // Mock up message context
        MessageImpl msg = new MessageImpl();
        WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
        msgCtx.put(
            SecurityContext.class.getName(),
            createSecurityContext(new CustomTokenPrincipal("alice"))
        );
        WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
       
        // Issue a token
        RequestSecurityTokenResponseCollectionType response =
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

        // Mock up message context
        MessageImpl msg = new MessageImpl();
        WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
        msgCtx.put(
            SecurityContext.class.getName(),
            createSecurityContext(new CustomTokenPrincipal("alice"))
        );
        WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
       
        // Issue a token
        RequestSecurityTokenResponseCollectionType response =
View Full Code Here

Examples of org.apache.ws.security.CustomTokenPrincipal

        // Mock up message context
        MessageImpl msg = new MessageImpl();
        WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
        msgCtx.put(
            SecurityContext.class.getName(),
            createSecurityContext(new CustomTokenPrincipal("alice"))
        );
        WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
       
        // Issue a token
        RequestSecurityTokenResponseCollectionType response =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.