View Javadoc

    1   /* Copyright 2004 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   * Represents an authority granted to an {@link Authentication} object.
    20   *
    21   * <p>
    22   * A <code>GrantedAuthority</code> must either represent itself as a
    23   * <code>String</code> or be specifically supported by an  {@link
    24   * AccessDecisionManager}.
    25   * </p>
    26   *
    27   * @author Ben Alex
    28   * @version $Id: GrantedAuthority.java,v 1.3 2005/11/17 00:55:49 benalex Exp $
    29   */
    30  public interface GrantedAuthority {
    31      //~ Methods ================================================================
    32
    33      /***
    34       * If the <code>GrantedAuthority</code> can be represented as a
    35       * <code>String</code> and that <code>String</code> is sufficient in
    36       * precision to be relied upon for an access control decision by an {@link
    37       * AccessDecisionManager} (or delegate), this method should return such a
    38       * <code>String</code>.
    39       *
    40       * <p>
    41       * If the <code>GrantedAuthority</code> cannot be expressed with sufficient
    42       * precision as a <code>String</code>,  <code>null</code> should be
    43       * returned. Returning <code>null</code> will require an
    44       * <code>AccessDecisionManager</code> (or delegate) to  specifically
    45       * support the <code>GrantedAuthority</code> implementation,  so returning
    46       * <code>null</code> should be avoided unless actually  required.
    47       * </p>
    48       *
    49       * @return a representation of the granted authority (or <code>null</code>
    50       *         if the granted authority cannot be expressed as a
    51       *         <code>String</code> with sufficient precision).
    52       */
    53      public String getAuthority();
    54  }