|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| UserDetails.java | - | - | - | - |
|
||||||||||||||
| 1 | /* Copyright 2004, 2005 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 java.io.Serializable; | |
| 19 | ||
| 20 | import org.acegisecurity.Authentication; | |
| 21 | import org.acegisecurity.GrantedAuthority; | |
| 22 | ||
| 23 | ||
| 24 | /** | |
| 25 | * Provides core user information. | |
| 26 | * | |
| 27 | * <P> | |
| 28 | * Implementations are not used directly by Acegi Security for security | |
| 29 | * purposes. They simply store user information which is later encapsulated | |
| 30 | * into {@link Authentication} objects. This allows non-security related user | |
| 31 | * information (such as email addresses, telephone numbers etc) to be stored | |
| 32 | * in a convenient location. | |
| 33 | * </p> | |
| 34 | * | |
| 35 | * <P> | |
| 36 | * Concrete implementations must take particular care to ensure the non-null | |
| 37 | * contract detailed for each method is enforced. See | |
| 38 | * {@link org.acegisecurity.providers.dao.User} for a | |
| 39 | * reference implementation (which you might like to extend). | |
| 40 | * </p> | |
| 41 | * | |
| 42 | * @author Ben Alex | |
| 43 | * @version $Id: UserDetails.java,v 1.7 2005/11/29 13:10:10 benalex Exp $ | |
| 44 | */ | |
| 45 | public interface UserDetails extends Serializable { | |
| 46 | //~ Methods ================================================================ | |
| 47 | ||
| 48 | /** | |
| 49 | * Indicates whether the user's account has expired. An expired account | |
| 50 | * cannot be authenticated. | |
| 51 | * | |
| 52 | * @return <code>true</code> if the user's account is valid (ie | |
| 53 | * non-expired), <code>false</code> if no longer valid (ie | |
| 54 | * expired) | |
| 55 | */ | |
| 56 | public boolean isAccountNonExpired(); | |
| 57 | ||
| 58 | /** | |
| 59 | * Indicates whether the user is locked or unlocked. A locked user cannot | |
| 60 | * be authenticated. | |
| 61 | * | |
| 62 | * @return <code>true</code> if the user is not locked, <code>false</code> | |
| 63 | * otherwise | |
| 64 | */ | |
| 65 | public boolean isAccountNonLocked(); | |
| 66 | ||
| 67 | /** | |
| 68 | * Returns the authorities granted to the user. Cannot return | |
| 69 | * <code>null</code>. | |
| 70 | * | |
| 71 | * @return the authorities (never <code>null</code>) | |
| 72 | */ | |
| 73 | public GrantedAuthority[] getAuthorities(); | |
| 74 | ||
| 75 | /** | |
| 76 | * Indicates whether the user's credentials (password) has expired. Expired | |
| 77 | * credentials prevent authentication. | |
| 78 | * | |
| 79 | * @return <code>true</code> if the user's credentials are valid (ie | |
| 80 | * non-expired), <code>false</code> if no longer valid (ie | |
| 81 | * expired) | |
| 82 | */ | |
| 83 | public boolean isCredentialsNonExpired(); | |
| 84 | ||
| 85 | /** | |
| 86 | * Indicates whether the user is enabled or disabled. A disabled user | |
| 87 | * cannot be authenticated. | |
| 88 | * | |
| 89 | * @return <code>true</code> if the user is enabled, <code>false</code> | |
| 90 | * otherwise | |
| 91 | */ | |
| 92 | public boolean isEnabled(); | |
| 93 | ||
| 94 | /** | |
| 95 | * Returns the password used to authenticate the user. Cannot return | |
| 96 | * <code>null</code>. | |
| 97 | * | |
| 98 | * @return the password (never <code>null</code>) | |
| 99 | */ | |
| 100 | public String getPassword(); | |
| 101 | ||
| 102 | /** | |
| 103 | * Returns the username used to authenticate the user. Cannot return | |
| 104 | * <code>null</code>. | |
| 105 | * | |
| 106 | * @return the username (never <code>null</code>) | |
| 107 | */ | |
| 108 | public String getUsername(); | |
| 109 | } |
|
||||||||||