View Javadoc

1   /* Copyright 2004, 2005 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
24   * <code>Authentication</code> could not be obtained from the
25   * <code>SecurityContextHolder</code>.
26   *
27   * @author Ben Alex
28   * @version $Id: AuthenticationCredentialsNotFoundEvent.java,v 1.3 2005/11/17 00:56:09 benalex Exp $
29   */
30  public class AuthenticationCredentialsNotFoundEvent
31      extends AbstractAuthorizationEvent {
32      //~ Instance fields ========================================================
33  
34      private AuthenticationCredentialsNotFoundException credentialsNotFoundException;
35      private ConfigAttributeDefinition configAttributeDefinition;
36  
37      //~ Constructors ===========================================================
38  
39      /***
40       * Construct the event.
41       *
42       * @param secureObject the secure object
43       * @param configAttribs that apply to the secure object
44       * @param credentialsNotFoundException exception returned to the caller
45       *        (contains reason)
46       *
47       * @throws IllegalArgumentException DOCUMENT ME!
48       */
49      public AuthenticationCredentialsNotFoundEvent(Object secureObject,
50          ConfigAttributeDefinition configAttribs,
51          AuthenticationCredentialsNotFoundException credentialsNotFoundException) {
52          super(secureObject);
53  
54          if ((configAttribs == null) || (credentialsNotFoundException == null)) {
55              throw new IllegalArgumentException(
56                  "All parameters are required and cannot be null");
57          }
58  
59          this.configAttributeDefinition = configAttribs;
60          this.credentialsNotFoundException = credentialsNotFoundException;
61      }
62  
63      //~ Methods ================================================================
64  
65      public ConfigAttributeDefinition getConfigAttributeDefinition() {
66          return configAttributeDefinition;
67      }
68  
69      public AuthenticationCredentialsNotFoundException getCredentialsNotFoundException() {
70          return credentialsNotFoundException;
71      }
72  }