use of org.springframework.security.authentication.event.AuthenticationFailureExpiredEvent in project spring-boot by spring-projects.
the class AuthenticationAuditListenerTests method testDetailsAreIncludedInAuditEvent.
@Test
void testDetailsAreIncludedInAuditEvent() {
Object details = new Object();
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken("user", "password");
authentication.setDetails(details);
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent(authentication, new BadCredentialsException("Bad user")));
assertThat(event.getAuditEvent().getType()).isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
assertThat(event.getAuditEvent().getData()).containsEntry("details", details);
}
use of org.springframework.security.authentication.event.AuthenticationFailureExpiredEvent in project spring-boot by spring-projects.
the class AuthenticationAuditListenerTests method testAuthenticationFailed.
@Test
void testAuthenticationFailed() {
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent(new UsernamePasswordAuthenticationToken("user", "password"), new BadCredentialsException("Bad user")));
assertThat(event.getAuditEvent().getType()).isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
}
Aggregations