use of org.jboss.security.plugins.JBossSecurityContext in project teiid by teiid.
the class TestJBossSecurityHelper method testAuthenticate.
public void testAuthenticate() throws Exception {
Credentials credentials = new Credentials("pass1".toCharArray());
String domains = "testFile";
AuthenticationManager authManager = new AuthenticationManager() {
public String getSecurityDomain() {
return null;
}
public boolean isValid(Principal principal, Object credential, Subject activeSubject) {
return true;
}
public boolean isValid(Principal principal, Object credential) {
return true;
}
@Override
public Principal getTargetPrincipal(Principal anotherDomainPrincipal, Map<String, Object> contextMap) {
return null;
}
@Override
public Subject getActiveSubject() {
return null;
}
@Override
public void logout(Principal arg0, Subject arg1) {
}
};
final SecurityDomainContext securityContext = new SecurityDomainContext(authManager, null, null, null, null, null);
JBossSecurityHelper ms = buildSecurityHelper(domains, securityContext);
// $NON-NLS-1$
Object c = ms.authenticate(domains, "user1", credentials, null);
// $NON-NLS-1$
assertTrue(c instanceof JBossSecurityContext);
assertEquals(domains, ((JBossSecurityContext) c).getSecurityDomain());
}
Aggregations