Search in sources :

Example 1 with FallbackPrincipalProvider

use of org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider in project jackrabbit by apache.

the class LoginModuleTest method testMultipleModules.

public void testMultipleModules() throws Exception {
    CallbackHandler ch = new CallbackHandlerImpl(new SimpleCredentials("user", "pass".toCharArray()), superuser, new ProviderRegistryImpl(new FallbackPrincipalProvider()), "admin", "anonymous");
    LoginContext context = new LoginContext(APP_NAME, new Subject(), ch, new TestConfiguration());
    context.login();
    assertFalse("no principal set", context.getSubject().getPrincipals().isEmpty());
}
Also used : SimpleCredentials(javax.jcr.SimpleCredentials) CallbackHandler(javax.security.auth.callback.CallbackHandler) FallbackPrincipalProvider(org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider) LoginContext(javax.security.auth.login.LoginContext) ProviderRegistryImpl(org.apache.jackrabbit.core.security.principal.ProviderRegistryImpl) Subject(javax.security.auth.Subject)

Aggregations

SimpleCredentials (javax.jcr.SimpleCredentials)1 Subject (javax.security.auth.Subject)1 CallbackHandler (javax.security.auth.callback.CallbackHandler)1 LoginContext (javax.security.auth.login.LoginContext)1 FallbackPrincipalProvider (org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider)1 ProviderRegistryImpl (org.apache.jackrabbit.core.security.principal.ProviderRegistryImpl)1