|
|
|
@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests {
|
|
|
|
|
public void testAuthenticationCredentialsNotFound() {
|
|
|
|
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
|
|
|
|
new AuthenticationCredentialsNotFoundEvent(this,
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(
|
|
|
|
|
new SecurityConfig("USER")),
|
|
|
|
|
new AuthenticationCredentialsNotFoundException("Bad user")));
|
|
|
|
|
assertThat(event.getAuditEvent().getType())
|
|
|
|
|
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
|
|
|
|
@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests {
|
|
|
|
|
public void testAuthorizationFailure() {
|
|
|
|
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
|
|
|
|
new AuthorizationFailureEvent(this,
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(
|
|
|
|
|
new SecurityConfig("USER")),
|
|
|
|
|
new UsernamePasswordAuthenticationToken("user", "password"),
|
|
|
|
|
new AccessDeniedException("Bad user")));
|
|
|
|
|
assertThat(event.getAuditEvent().getType())
|
|
|
|
@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests {
|
|
|
|
|
authentication.setDetails(details);
|
|
|
|
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
|
|
|
|
new AuthorizationFailureEvent(this,
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
|
|
|
|
Collections.<ConfigAttribute>singletonList(
|
|
|
|
|
new SecurityConfig("USER")),
|
|
|
|
|
authentication, new AccessDeniedException("Bad user")));
|
|
|
|
|
assertThat(event.getAuditEvent().getType())
|
|
|
|
|
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);
|
|
|
|
|