1 /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 package org.acegisecurity.event.authorization;
17
18 import org.acegisecurity.AuthenticationCredentialsNotFoundException;
19 import org.acegisecurity.ConfigAttributeDefinition;
20
21
22 /**
23 * Indicates a secure object invocation failed because the <code>Authentication</code> could not be obtained from
24 * the <code>SecurityContextHolder</code>.
25 *
26 * @author Ben Alex
27 * @version $Id: AuthenticationCredentialsNotFoundEvent.java 1496 2006-05-23 13:38:33Z benalex $
28 */
29 public class AuthenticationCredentialsNotFoundEvent extends AbstractAuthorizationEvent {
30 //~ Instance fields ================================================================================================
31
32 private AuthenticationCredentialsNotFoundException credentialsNotFoundException;
33 private ConfigAttributeDefinition configAttributeDefinition;
34
35 //~ Constructors ===================================================================================================
36
37 /**
38 * Construct the event.
39 *
40 * @param secureObject the secure object
41 * @param configAttribs that apply to the secure object
42 * @param credentialsNotFoundException exception returned to the caller
43 * (contains reason)
44 *
45 * @throws IllegalArgumentException DOCUMENT ME!
46 */
47 public AuthenticationCredentialsNotFoundEvent(Object secureObject, ConfigAttributeDefinition configAttribs,
48 AuthenticationCredentialsNotFoundException credentialsNotFoundException) {
49 super(secureObject);
50
51 if ((configAttribs == null) || (credentialsNotFoundException == null)) {
52 throw new IllegalArgumentException("All parameters are required and cannot be null");
53 }
54
55 this.configAttributeDefinition = configAttribs;
56 this.credentialsNotFoundException = credentialsNotFoundException;
57 }
58
59 //~ Methods ========================================================================================================
60
61 public ConfigAttributeDefinition getConfigAttributeDefinition() {
62 return configAttributeDefinition;
63 }
64
65 public AuthenticationCredentialsNotFoundException getCredentialsNotFoundException() {
66 return credentialsNotFoundException;
67 }
68 }