Search in sources :

Example 1 with LdapIdentityProvider

use of org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider in project jackrabbit-oak by apache.

the class LdapProviderTest method testAuthenticateValidateFalseTrue.

@Test
public void testAuthenticateValidateFalseTrue() throws Exception {
    providerConfig.getAdminPoolConfig().setMaxActive(2).setLookupOnValidate(false);
    providerConfig.getUserPoolConfig().setMaxActive(2).setLookupOnValidate(true);
    idp.close();
    idp = new LdapIdentityProvider(providerConfig);
    SimpleCredentials creds = new SimpleCredentials(TEST_USER1_UID, "pass".toCharArray());
    for (int i = 0; i < 8; i++) {
        ExternalUser user = idp.authenticate(creds);
        assertNotNull("User 1 must authenticate", user);
        assertEquals("User Ref", TEST_USER1_DN, user.getExternalId().getId());
    }
}
Also used : LdapIdentityProvider(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider) SimpleCredentials(javax.jcr.SimpleCredentials) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Example 2 with LdapIdentityProvider

use of org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider in project jackrabbit-oak by apache.

the class LdapProviderTest method testAuthenticateValidateTrueFalse.

@Test
public void testAuthenticateValidateTrueFalse() throws Exception {
    providerConfig.getAdminPoolConfig().setMaxActive(2).setLookupOnValidate(true);
    providerConfig.getUserPoolConfig().setMaxActive(2).setLookupOnValidate(false);
    idp.close();
    idp = new LdapIdentityProvider(providerConfig);
    SimpleCredentials creds = new SimpleCredentials(TEST_USER1_UID, "pass".toCharArray());
    for (int i = 0; i < 8; i++) {
        ExternalUser user = idp.authenticate(creds);
        assertNotNull("User 1 must authenticate (i=" + i + ")", user);
        assertEquals("User Ref", TEST_USER1_DN, user.getExternalId().getId());
    }
}
Also used : LdapIdentityProvider(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider) SimpleCredentials(javax.jcr.SimpleCredentials) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Example 3 with LdapIdentityProvider

use of org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider in project jackrabbit-oak by apache.

the class LdapProviderTest method testAuthenticateValidateTrueTrue.

@Test
public void testAuthenticateValidateTrueTrue() throws Exception {
    providerConfig.getAdminPoolConfig().setMaxActive(2).setLookupOnValidate(true);
    providerConfig.getUserPoolConfig().setMaxActive(2).setLookupOnValidate(true);
    idp.close();
    idp = new LdapIdentityProvider(providerConfig);
    SimpleCredentials creds = new SimpleCredentials(TEST_USER1_UID, "pass".toCharArray());
    for (int i = 0; i < 8; i++) {
        ExternalUser user = idp.authenticate(creds);
        assertNotNull("User 1 must authenticate (i=" + i + ")", user);
        assertEquals("User Ref", TEST_USER1_DN, user.getExternalId().getId());
    }
}
Also used : LdapIdentityProvider(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider) SimpleCredentials(javax.jcr.SimpleCredentials) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Example 4 with LdapIdentityProvider

use of org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider in project jackrabbit-oak by apache.

the class LdapProviderTest method testAuthenticateValidateFalseFalse.

@Test
public void testAuthenticateValidateFalseFalse() throws Exception {
    providerConfig.getAdminPoolConfig().setMaxActive(2).setLookupOnValidate(false);
    providerConfig.getUserPoolConfig().setMaxActive(2).setLookupOnValidate(false);
    idp.close();
    idp = new LdapIdentityProvider(providerConfig);
    SimpleCredentials creds = new SimpleCredentials(TEST_USER1_UID, "pass".toCharArray());
    for (int i = 0; i < 8; i++) {
        ExternalUser user = idp.authenticate(creds);
        assertNotNull("User 1 must authenticate", user);
        assertEquals("User Ref", TEST_USER1_DN, user.getExternalId().getId());
    }
}
Also used : LdapIdentityProvider(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider) SimpleCredentials(javax.jcr.SimpleCredentials) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) Test(org.junit.Test)

Example 5 with LdapIdentityProvider

use of org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider in project jackrabbit-oak by apache.

the class LargeLdapProviderTest method createIDP.

protected LdapIdentityProvider createIDP() {
    providerConfig = new LdapProviderConfig().setName(IDP_NAME).setHostname("127.0.0.1").setPort(LDAP_SERVER.getPort()).setBindDN(USER_DN).setBindPassword(USER_PWD).setGroupMemberAttribute("member");
    providerConfig.getUserConfig().setBaseDN(AbstractServer.EXAMPLE_DN).setObjectClasses("inetOrgPerson");
    providerConfig.getGroupConfig().setBaseDN(AbstractServer.EXAMPLE_DN).setObjectClasses(InternalLdapServer.GROUP_CLASS_ATTR);
    providerConfig.getAdminPoolConfig().setMaxActive(0);
    providerConfig.getUserPoolConfig().setMaxActive(0);
    return new LdapIdentityProvider(providerConfig);
}
Also used : LdapIdentityProvider(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider) LdapProviderConfig(org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapProviderConfig)

Aggregations

LdapIdentityProvider (org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider)6 SimpleCredentials (javax.jcr.SimpleCredentials)4 ExternalUser (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser)4 Test (org.junit.Test)4 LdapProviderConfig (org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapProviderConfig)2