1 17 18 package org.apache.geronimo.security.bridge; 19 20 import java.util.Set ; 21 import javax.security.auth.Subject ; 22 23 import org.apache.geronimo.security.ContextManager; 24 import org.apache.geronimo.security.IdentificationPrincipal; 25 26 27 30 public class ConfiguredIdentityUserPasswordBridgeTest extends AbstractBridgeTest { 31 32 private ConfiguredIdentityUserPasswordRealmBridge bridge; 33 34 protected void setUp() throws Exception { 35 super.setUp(); 36 bridge = new ConfiguredIdentityUserPasswordRealmBridge(TestLoginModule.JAAS_NAME, AbstractBridgeTest.USER, AbstractBridgeTest.PASSWORD); 37 } 38 39 public void testConfiguredIdentityBridge() throws Exception { 40 Subject sourceSubject = new Subject (); 41 Subject targetSubject = bridge.mapSubject(sourceSubject); 42 43 assertTrue("expected non-null client subject", targetSubject != null); 44 Set set = targetSubject.getPrincipals(IdentificationPrincipal.class); 45 assertEquals("client subject should have one ID principal", set.size(), 1); 46 IdentificationPrincipal idp = (IdentificationPrincipal)set.iterator().next(); 47 targetSubject = ContextManager.getRegisteredSubject(idp.getId()); 48 49 checkValidSubject(targetSubject); 50 } 51 52 } 53 | Popular Tags |