use of org.simbasecurity.core.audit.AuditLogEvent in project simba-os by cegeka.
the class CheckShowChangePasswordCommandTest method continueOtherwise.
@Test
public void continueOtherwise() throws Exception {
when(chainContextMock.isShowChangePasswordRequest()).thenReturn(false);
command.execute(chainContextMock);
verify(chainContextMock).isShowChangePasswordRequest();
verify(chainContextMock).getUserName();
verify(chainContextMock).getClientIpAddress();
verify(auditMock).log(captor.capture());
AuditLogEvent resultAuditLogEvent = captor.getValue();
assertEquals(AuditLogEventCategory.AUTHENTICATION, resultAuditLogEvent.getCategory());
assertEquals(SUCCESS + CHECK_SHOW_PASSWORD, resultAuditLogEvent.getMessage());
}
use of org.simbasecurity.core.audit.AuditLogEvent in project simba-os by cegeka.
the class CheckPasswordExpiredCommandTest method testExecute_notMustChangePassword_continue.
@Test
public void testExecute_notMustChangePassword_continue() throws Exception {
when(credentialServiceMock.mustChangePasswordOnNextLogon(USER_NAME)).thenReturn(Boolean.FALSE);
State result = command.execute(contextMock);
verify(auditMock).log(captor.capture());
AuditLogEvent resultAuditLogEvent = captor.getValue();
assertEquals(AuditLogEventCategory.AUTHENTICATION, resultAuditLogEvent.getCategory());
assertEquals(SUCCESS + CHECK_PASSWORD_EXPIRED, resultAuditLogEvent.getMessage());
assertEquals(State.CONTINUE, result);
}
use of org.simbasecurity.core.audit.AuditLogEvent in project simba-os by cegeka.
the class CheckPasswordExpiredCommandTest method testExecute_mustChangePasswordAndRequestIsDirectlyToSimba_redirectToChangePasswordWithSuccesURLAsTarget.
@Test
public void testExecute_mustChangePasswordAndRequestIsDirectlyToSimba_redirectToChangePasswordWithSuccesURLAsTarget() throws Exception {
when(credentialServiceMock.mustChangePasswordOnNextLogon(USER_NAME)).thenReturn(Boolean.TRUE);
when(credentialServiceMock.getSuccessURL(USER_NAME)).thenReturn("successURL");
when(contextMock.getRequestURL()).thenReturn("requestURL");
when(contextMock.getSimbaWebURL()).thenReturn("simbaWebURL");
State state = command.execute(contextMock);
assertEquals(State.FINISH, state);
verify(auditMock).log(captor.capture());
AuditLogEvent resultAuditLogEvent = captor.getValue();
assertEquals(AuditLogEventCategory.AUTHENTICATION, resultAuditLogEvent.getCategory());
assertEquals(MUST_CHANGE_PASSWORD, resultAuditLogEvent.getMessage());
verify(contextMock).redirectToChangePasswordWithFilter();
}
use of org.simbasecurity.core.audit.AuditLogEvent in project simba-os by cegeka.
the class ExcludeResourceCommandTest method testExecute_resourceExcluded_finishDoFilterSetPrincipal.
@Test
public void testExecute_resourceExcluded_finishDoFilterSetPrincipal() throws Exception {
when(mockExcludedResourceService.isResourceExcluded(DUMMY_URL)).thenReturn(TRUE);
assertEquals(State.FINISH, command.execute(contextMock));
verify(contextMock).activateAction(ActionType.DO_FILTER_AND_SET_PRINCIPAL);
verify(auditMock).log(captor.capture());
AuditLogEvent resultAuditLogEvent = captor.getValue();
assertEquals(AuditLogEventCategory.AUTHENTICATION, resultAuditLogEvent.getCategory());
assertEquals(SUCCESS + "Resource excluded [" + DUMMY_URL + "]", resultAuditLogEvent.getMessage());
}
use of org.simbasecurity.core.audit.AuditLogEvent in project simba-os by cegeka.
the class JaasLoginCommandTest method successfulLogin.
@Test
public void successfulLogin() throws Exception {
TestLoginModule.setValues(false, true, true, false);
assertEquals(State.CONTINUE, jaasLoginCommand.execute(contextMock));
verify(auditMock).log(captor.capture());
AuditLogEvent resultAuditLogEvent = captor.getValue();
assertEquals(AuditLogEventCategory.AUTHENTICATION, resultAuditLogEvent.getCategory());
}
Aggregations