use of org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials in project jackrabbit-oak by apache.
the class UserAuthenticationTest method testAuthenticateImpersonationCredentials2.
@Test
public void testAuthenticateImpersonationCredentials2() throws Exception {
SimpleCredentials sc = new SimpleCredentials(userId, new char[0]);
assertTrue(authentication.authenticate(new ImpersonationCredentials(sc, new TestAuthInfo())));
}
use of org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials in project jackrabbit-oak by apache.
the class UserAuthenticationTest method testAuthenticateInvalidImpersonationCredentials.
@Test
public void testAuthenticateInvalidImpersonationCredentials() throws Exception {
List<Credentials> invalid = new ArrayList<Credentials>();
invalid.add(new ImpersonationCredentials(new GuestCredentials(), adminSession.getAuthInfo()));
invalid.add(new ImpersonationCredentials(new SimpleCredentials(adminSession.getAuthInfo().getUserID(), new char[0]), new TestAuthInfo()));
invalid.add(new ImpersonationCredentials(new SimpleCredentials("unknown", new char[0]), adminSession.getAuthInfo()));
invalid.add(new ImpersonationCredentials(new SimpleCredentials("unknown", new char[0]), new TestAuthInfo()));
for (Credentials creds : invalid) {
try {
authentication.authenticate(creds);
fail("LoginException expected");
} catch (LoginException e) {
// success
assertTrue(e instanceof FailedLoginException);
}
}
}
Aggregations