use of org.springframework.aop.framework.ReflectiveMethodInvocation in project zhcet-web by zhcet-amu.
the class PathAuthorizationAuditListener method onAuthorizationFailureEvent.
private void onAuthorizationFailureEvent(AuthorizationFailureEvent event) {
Map<String, Object> data = new HashMap<>();
data.put("authorities", event.getAuthentication().getAuthorities());
data.put("type", event.getAccessDeniedException().getClass().getName());
data.put("message", event.getAccessDeniedException().getMessage());
if (event.getSource() instanceof FilterInvocation)
data.put("requestUrl", ((FilterInvocation) event.getSource()).getRequestUrl());
else if (event.getSource() instanceof ReflectiveMethodInvocation)
data.put("source", event.getSource());
if (event.getAuthentication().getDetails() != null) {
data.put("details", event.getAuthentication().getDetails());
}
publish(new AuditEvent(event.getAuthentication().getName(), AuthorizationAuditListener.AUTHORIZATION_FAILURE, data));
}
use of org.springframework.aop.framework.ReflectiveMethodInvocation in project zhcet-web by zhcet-amu.
the class PathAuthorizationAuditListener method onAuthenticationCredentialsNotFoundEvent.
private void onAuthenticationCredentialsNotFoundEvent(AuthenticationCredentialsNotFoundEvent event) {
Map<String, Object> data = new HashMap<>();
data.put("type", event.getCredentialsNotFoundException().getClass().getName());
data.put("message", event.getCredentialsNotFoundException().getMessage());
if (event.getSource() instanceof FilterInvocation)
data.put("requestUrl", ((FilterInvocation) event.getSource()).getRequestUrl());
else if (event.getSource() instanceof ReflectiveMethodInvocation)
data.put("source", event.getSource());
publish(new AuditEvent("<unknown>", AuthenticationAuditListener.AUTHENTICATION_FAILURE, data));
}
Aggregations