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.runas;
    17
    18  import org.acegisecurity.Authentication;
    19  import org.acegisecurity.ConfigAttribute;
    20  import org.acegisecurity.ConfigAttributeDefinition;
    21  import org.acegisecurity.RunAsManager;
    22
    23
    24  /***
    25   * Implementation of a {@link RunAsManager} that does nothing.
    26   *
    27   * <p>
    28   * This class should be used if you do not require run-as authenticaiton
    29   * replacement functionality.
    30   * </p>
    31   *
    32   * @author Ben Alex
    33   * @version $Id: NullRunAsManager.java,v 1.2 2005/11/17 00:55:51 benalex Exp $
    34   */
    35  public class NullRunAsManager implements RunAsManager {
    36      //~ Methods ================================================================
    37
    38      public Authentication buildRunAs(Authentication authentication,
    39          Object object, ConfigAttributeDefinition config) {
    40          return null;
    41      }
    42
    43      public boolean supports(ConfigAttribute attribute) {
    44          return false;
    45      }
    46
    47      public boolean supports(Class clazz) {
    48          return true;
    49      }
    50  }