use of javax.jcr.SimpleCredentials 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());
}
}
use of javax.jcr.SimpleCredentials 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());
}
}
use of javax.jcr.SimpleCredentials 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());
}
}
use of javax.jcr.SimpleCredentials in project jackrabbit-oak by apache.
the class LdapProviderTest method testAuthenticateMissing.
@Test
public void testAuthenticateMissing() throws Exception {
SimpleCredentials creds = new SimpleCredentials("foobar" + TEST_USER1_UID, "pass".toCharArray());
ExternalUser user = idp.authenticate(creds);
assertNull("Authenticate must return NULL for unknown user", user);
}
use of javax.jcr.SimpleCredentials in project jackrabbit-oak by apache.
the class LdapLoginTestBase method testSyncCreateUser.
@Test
public void testSyncCreateUser() throws Exception {
ContentSession cs = null;
try {
cs = login(new SimpleCredentials(USER_ID, USER_PWD.toCharArray()));
root.refresh();
Authorizable user = userManager.getAuthorizable(USER_ID);
assertNotNull(user);
assertTrue(user.hasProperty(USER_PROP));
Tree userTree = cs.getLatestRoot().getTree(user.getPath());
assertFalse(userTree.hasProperty(UserConstants.REP_PASSWORD));
assertNull(userManager.getAuthorizable(GROUP_DN));
} finally {
if (cs != null) {
cs.close();
}
options.clear();
}
}
Aggregations