View Javadoc

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.providers.jaas;
17  
18  import org.acegisecurity.GrantedAuthority;
19  
20  import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
21  
22  import javax.security.auth.login.LoginContext;
23  
24  
25  /**
26   * UsernamePasswordAuthenticationToken extension to carry the Jaas LoginContext that the user was logged into
27   *
28   * @author Ray Krueger
29   */
30  public class JaasAuthenticationToken extends UsernamePasswordAuthenticationToken {
31      //~ Instance fields ================================================================================================
32  
33      private static final long serialVersionUID = 1L;
34      private transient LoginContext loginContext = null;
35  
36      //~ Constructors ===================================================================================================
37  
38      public JaasAuthenticationToken(Object principal, Object credentials, LoginContext loginContext) {
39          super(principal, credentials);
40          this.loginContext = loginContext;
41      }
42  
43      public JaasAuthenticationToken(Object principal, Object credentials, GrantedAuthority[] authorities,
44          LoginContext loginContext) {
45          super(principal, credentials, authorities);
46          this.loginContext = loginContext;
47      }
48  
49      //~ Methods ========================================================================================================
50  
51      public LoginContext getLoginContext() {
52          return loginContext;
53      }
54  }