1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.event.authorization;
17
18 import org.acegisecurity.AccessDeniedException;
19 import org.acegisecurity.Authentication;
20 import org.acegisecurity.ConfigAttributeDefinition;
21
22
23 /***
24 * Indicates a secure object invocation failed because the principal could not
25 * be authorized for the request.
26 *
27 * @author Ben Alex
28 * @version $Id: AuthorizationFailureEvent.java,v 1.3 2005/11/17 00:56:09 benalex Exp $
29 */
30 public class AuthorizationFailureEvent extends AbstractAuthorizationEvent {
31
32
33 private AccessDeniedException accessDeniedException;
34 private Authentication authentication;
35 private ConfigAttributeDefinition configAttributeDefinition;
36
37
38
39 /***
40 * Construct the event.
41 *
42 * @param secureObject the secure object
43 * @param configAttribs that apply to the secure object
44 * @param authentication that was found in the <code>SecurityContextHolder</code>
45 * @param accessDeniedException that was returned by the
46 * <code>AccessDecisionManager</code>
47 *
48 * @throws IllegalArgumentException if any null arguments are presented.
49 */
50 public AuthorizationFailureEvent(Object secureObject,
51 ConfigAttributeDefinition configAttribs, Authentication authentication,
52 AccessDeniedException accessDeniedException) {
53 super(secureObject);
54
55 if ((configAttribs == null) || (authentication == null)
56 || (accessDeniedException == null)) {
57 throw new IllegalArgumentException(
58 "All parameters are required and cannot be null");
59 }
60
61 this.configAttributeDefinition = configAttribs;
62 this.authentication = authentication;
63 this.accessDeniedException = accessDeniedException;
64 }
65
66
67
68 public AccessDeniedException getAccessDeniedException() {
69 return accessDeniedException;
70 }
71
72 public Authentication getAuthentication() {
73 return authentication;
74 }
75
76 public ConfigAttributeDefinition getConfigAttributeDefinition() {
77 return configAttributeDefinition;
78 }
79 }