Search in sources :

Example 61 with ExternalUser

use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser in project jackrabbit-oak by apache.

the class LdapProviderTest method testAuthenticateCaseInsensitive.

@Test
public void testAuthenticateCaseInsensitive() throws Exception {
    SimpleCredentials creds = new SimpleCredentials(TEST_USER1_UID.toUpperCase(), "pass".toCharArray());
    ExternalUser user = idp.authenticate(creds);
    assertNotNull("User 1 must authenticate", user);
    assertEquals("User Ref", TEST_USER1_DN, user.getExternalId().getId());
}
Also used : SimpleCredentials(javax.jcr.SimpleCredentials) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Example 62 with ExternalUser

use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser in project jackrabbit-oak by apache.

the class LdapProviderTest method testGetUserProperties.

@Test
public void testGetUserProperties() throws Exception {
    ExternalUser user = idp.getUser(TEST_USER1_UID);
    assertNotNull("User 1 must exist", user);
    Map<String, ?> properties = user.getProperties();
    assertThat((Map<String, Collection<String>>) properties, Matchers.<String, Collection<String>>hasEntry(Matchers.equalTo("objectclass"), Matchers.containsInAnyOrder("inetOrgPerson", "top", "person", "organizationalPerson")));
    assertThat(properties, Matchers.<String, Object>hasEntry("uid", "hhornblo"));
    assertThat(properties, Matchers.<String, Object>hasEntry("givenname", "Horatio"));
    assertThat(properties, Matchers.<String, Object>hasEntry("description", "Capt. Horatio Hornblower, R.N"));
    assertThat(properties, Matchers.<String, Object>hasEntry("sn", "Hornblower"));
    assertThat(properties, Matchers.not(Matchers.<String, Object>hasEntry("mail", "hhornblo@royalnavy.mod.uk")));
}
Also used : ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Collection(java.util.Collection) Test(org.junit.Test)

Example 63 with ExternalUser

use of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser in project jackrabbit-oak by apache.

the class LdapProviderTest method testSplitDNIntermediatePath.

@Test
public void testSplitDNIntermediatePath() throws Exception {
    providerConfig.getUserConfig().setMakeDnPath(true);
    ExternalUser user = idp.getUser(TEST_USER1_UID);
    assertNotNull("User 1 must exist", user);
    assertEquals("Intermediate path must be the split dn", TEST_USER1_PATH, user.getIntermediatePath());
}
Also used : ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Aggregations

ExternalUser (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser)63 Test (org.junit.Test)56 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)28 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)23 ExternalIdentityRef (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef)19 User (org.apache.jackrabbit.api.security.user.User)12 SimpleCredentials (javax.jcr.SimpleCredentials)10 Group (org.apache.jackrabbit.api.security.user.Group)8 ExternalGroup (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup)8 HashMap (java.util.HashMap)7 ExternalIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity)6 SyncResult (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult)6 PrincipalImpl (org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl)6 Tree (org.apache.jackrabbit.oak.api.Tree)5 Principal (java.security.Principal)4 Nonnull (javax.annotation.Nonnull)4 Value (javax.jcr.Value)4 UserManager (org.apache.jackrabbit.api.security.user.UserManager)4 LdapIdentityProvider (org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider)4 Collection (java.util.Collection)3