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.userdetails;
    17
    18  import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
    19  import org.springframework.dao.DataAccessException;
    20
    21
    22  /***
    23   * Defines an interface for implementations that wish to provide data access
    24   * services to the {@link DaoAuthenticationProvider}.
    25   *
    26   * <p>
    27   * The interface requires only one read-only method, which simplifies support
    28   * of new data access strategies.
    29   * </p>
    30   *
    31   * @author Ben Alex
    32   * @version $Id: UserDetailsService.java,v 1.9 2005/11/29 13:10:10 benalex Exp $
    33   */
    34  public interface UserDetailsService {
    35      //~ Methods ================================================================
    36
    37      /***
    38       * Locates the user based on the username. In the actual implementation,
    39       * the search may possibly be case insensitive, or case insensitive
    40       * depending on how the implementaion instance is configured. In this
    41       * case, the <code>UserDetails</code> object that comes back may have a
    42       * username that is of a different case than what was actually requested..
    43       *
    44       * @param username the username presented to the {@link
    45       *        DaoAuthenticationProvider}
    46       *
    47       * @return a fully populated user record (never <code>null</code>)
    48       *
    49       * @throws UsernameNotFoundException if the user could not be found or the
    50       *         user has no GrantedAuthority
    51       * @throws DataAccessException if user could not be found for a
    52       *         repository-specific reason
    53       */
    54      public UserDetails loadUserByUsername(String username)
    55          throws UsernameNotFoundException, DataAccessException;
    56  }