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;
17  
18  /***
19   * Evaluates <code>Authentication</code> tokens
20   *
21   * @author Ben Alex
22   * @version $Id: AuthenticationTrustResolver.java,v 1.2 2005/11/17 00:55:49 benalex Exp $
23   */
24  public interface AuthenticationTrustResolver {
25      //~ Methods ================================================================
26  
27      /***
28       * Indicates whether the passed <code>Authentication</code> token
29       * represents an anonymous user. Typically the framework will call this
30       * method if it is trying to decide whether an
31       * <code>AccessDeniedException</code> should result in a final rejection
32       * (ie as would be the case if the principal was non-anonymous/fully
33       * authenticated) or direct the principal to attempt actual authentication
34       * (ie as would be the case if the <code>Authentication</code> was merely
35       * anonymous).
36       *
37       * @param authentication to test (may be <code>null</code> in which case
38       *        the method will always return <code>false</code>)
39       *
40       * @return <code>true</code> the passed authentication token represented an
41       *         anonymous principal, <code>false</code> otherwise
42       */
43      public boolean isAnonymous(Authentication authentication);
44  
45      /***
46       * Indicates whether the passed <code>Authentication</code> token
47       * represents user that has been remembered (ie not a user that has been
48       * fully authenticated).
49       * 
50       * <p>
51       * <b>No part of the framework uses this method</b>, as it is a weak
52       * definition of trust levels. The method is provided simply to assist
53       * with custom <code>AccessDecisionVoter</code>s and the like that you
54       * might develop. Of course, you don't need to use this method either and
55       * can develop your own "trust level" hierarchy instead.
56       * </p>
57       *
58       * @param authentication to test (may be <code>null</code> in which case
59       *        the method will always return <code>false</code>)
60       *
61       * @return <code>true</code> the passed authentication token represented a
62       *         principal authenticated using a remember-me token,
63       *         <code>false</code> otherwise
64       */
65      public boolean isRememberMe(Authentication authentication);
66  }