use of org.apache.cxf.sts.IdentityMapper in project cxf by apache.
the class EhCacheIdentityCacheTest method testTwoDistinctMappings.
@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");
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"));
cache.close();
}
use of org.apache.cxf.sts.IdentityMapper in project cxf by apache.
the class MemoryIdentityCacheTest method testTwoDistinctAndOneRelatedMapping.
@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"));
assertNotNull(cache.get("user_ddd", "REALM_D"));
assertEquals(4, cache.get("user_aaa", "REALM_A").size());
assertEquals(4, cache.get("user_bbb", "REALM_B").size());
assertEquals(4, cache.get("user_ccc", "REALM_C").size());
assertEquals(4, cache.get("user_ddd", "REALM_D").size());
}
use of org.apache.cxf.sts.IdentityMapper in project cxf by apache.
the class MemoryIdentityCacheTest method testOneMapping.
// tests TokenStore apis for storing in the cache.
@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"));
}
use of org.apache.cxf.sts.IdentityMapper in project cxf by apache.
the class MemoryIdentityCacheTest method testTwoDistinctMappings.
@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"));
}
Aggregations