Search in sources :

Example 1 with UserIdCredentials

use of org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials in project jackrabbit-oak by apache.

the class SystemUserImplTest method testGetCredentials.

@Test
public void testGetCredentials() throws Exception {
    User user = createUser(null);
    Credentials creds = user.getCredentials();
    assertTrue(creds instanceof UserIdCredentials);
    UserIdCredentials impl = (UserIdCredentials) creds;
    assertEquals(uid, impl.getUserId());
}
Also used : UserIdCredentials(org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials) User(org.apache.jackrabbit.api.security.user.User) UserIdCredentials(org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials) ImpersonationCredentials(org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials) SimpleCredentials(javax.jcr.SimpleCredentials) Credentials(javax.jcr.Credentials) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 2 with UserIdCredentials

use of org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials in project jackrabbit-oak by apache.

the class UserImplTest method testGetCredentialsUserWithoutPassword.

@Test
public void testGetCredentialsUserWithoutPassword() throws Exception {
    user = userMgr.createUser(uid, null);
    root.commit();
    Credentials creds = user.getCredentials();
    assertTrue(creds instanceof UserIdCredentials);
    assertEquals(uid, ((UserIdCredentials) creds).getUserId());
}
Also used : UserIdCredentials(org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials) UserIdCredentials(org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials) Credentials(javax.jcr.Credentials) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Aggregations

Credentials (javax.jcr.Credentials)2 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)2 UserIdCredentials (org.apache.jackrabbit.oak.spi.security.user.UserIdCredentials)2 Test (org.junit.Test)2 SimpleCredentials (javax.jcr.SimpleCredentials)1 User (org.apache.jackrabbit.api.security.user.User)1 ImpersonationCredentials (org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials)1