use of org.neo4j.kernel.api.security.AuthenticationResult in project neo4j by neo4j.
the class MultiRealmAuthManagerTest method shouldFailAuthenticationIfUserIsNotFound.
@Test
public void shouldFailAuthenticationIfUserIsNotFound() throws Throwable {
// Given
manager.start();
// When
AuthSubject authSubject = manager.login(authToken("unknown", "abc123")).subject();
AuthenticationResult result = authSubject.getAuthenticationResult();
// Then
assertThat(result, equalTo(AuthenticationResult.FAILURE));
logProvider.assertExactly(error("[%s]: failed to log in: invalid principal or credentials", "unknown"));
}
use of org.neo4j.kernel.api.security.AuthenticationResult in project neo4j by neo4j.
the class MultiRealmAuthManagerTest method shouldActivateExistingUser.
@Test
public void shouldActivateExistingUser() throws Throwable {
// Given
users.create(newUser("jake", "abc123", false));
manager.start();
userManager.suspendUser("jake");
// When
userManager.activateUser("jake", false);
setMockAuthenticationStrategyResult("jake", "abc123", AuthenticationResult.SUCCESS);
// Then
AuthenticationResult result = manager.login(authToken("jake", "abc123")).subject().getAuthenticationResult();
assertThat(result, equalTo(AuthenticationResult.SUCCESS));
}
use of org.neo4j.kernel.api.security.AuthenticationResult in project neo4j by neo4j.
the class MultiRealmAuthManagerTest method shouldFindAndAuthenticateUserAndReturnPasswordChangeIfRequired.
@Test
public void shouldFindAndAuthenticateUserAndReturnPasswordChangeIfRequired() throws Throwable {
// Given
users.create(newUser("jake", "abc123", true));
manager.start();
setMockAuthenticationStrategyResult("jake", "abc123", AuthenticationResult.SUCCESS);
// When
AuthenticationResult result = manager.login(authToken("jake", "abc123")).subject().getAuthenticationResult();
// Then
assertThat(result, equalTo(AuthenticationResult.PASSWORD_CHANGE_REQUIRED));
logProvider.assertExactly(info("[jake]: logged in"));
}
Aggregations