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.Authentication;
19  import org.acegisecurity.ConfigAttributeDefinition;
20  
21  
22  /***
23   * Event indicating a secure object was invoked successfully.
24   * 
25   * <P>
26   * Published just before the secure object attempts to proceed.
27   * </p>
28   *
29   * @author Ben Alex
30   * @version $Id: AuthorizedEvent.java,v 1.2 2005/11/17 00:56:09 benalex Exp $
31   */
32  public class AuthorizedEvent extends AbstractAuthorizationEvent {
33      //~ Instance fields ========================================================
34  
35      private Authentication authentication;
36      private ConfigAttributeDefinition configAttributeDefinition;
37  
38      //~ Constructors ===========================================================
39  
40      /***
41       * Construct the event.
42       *
43       * @param secureObject the secure object
44       * @param configAttribs that apply to the secure object
45       * @param authentication that successfully called the secure object
46       *
47       * @throws IllegalArgumentException DOCUMENT ME!
48       */
49      public AuthorizedEvent(Object secureObject,
50          ConfigAttributeDefinition configAttribs, Authentication authentication) {
51          super(secureObject);
52  
53          if ((configAttribs == null) || (authentication == null)) {
54              throw new IllegalArgumentException(
55                  "All parameters are required and cannot be null");
56          }
57  
58          this.configAttributeDefinition = configAttribs;
59          this.authentication = authentication;
60      }
61  
62      //~ Methods ================================================================
63  
64      public Authentication getAuthentication() {
65          return authentication;
66      }
67  
68      public ConfigAttributeDefinition getConfigAttributeDefinition() {
69          return configAttributeDefinition;
70      }
71  }