01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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:
20: import org.springframework.dao.DataAccessException;
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 1784 2007-02-24 21:00:24Z luke_t $
33: */
34: public interface UserDetailsService {
35: //~ Methods ========================================================================================================
36:
37: /**
38: * Locates the user based on the username. In the actual implementation, the search may possibly be case
39: * insensitive, or case insensitive depending on how the implementaion instance is configured. In this case, the
40: * <code>UserDetails</code> object that comes back may have a username that is of a different case than what was
41: * actually requested..
42: *
43: * @param username the username presented to the {@link DaoAuthenticationProvider}
44: *
45: * @return a fully populated user record (never <code>null</code>)
46: *
47: * @throws UsernameNotFoundException if the user could not be found or the user has no GrantedAuthority
48: * @throws DataAccessException if user could not be found for a repository-specific reason
49: */
50: UserDetails loadUserByUsername(String username)
51: throws UsernameNotFoundException, DataAccessException;
52: }
|