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