Interface UserDetails
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
User
public interface UserDetails extends java.io.SerializableProvides core user information.Implementations are not used directly by Spring Security for security purposes. They simply store user information which is later encapsulated into
Authenticationobjects. This allows non-security related user information (such as email addresses, telephone numbers etc) to be stored in a convenient location.Concrete implementations must take particular care to ensure the non-null contract detailed for each method is enforced. See
Userfor a reference implementation (which you might like to extend or use in your code).- See Also:
UserDetailsService,UserCache
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<? extends GrantedAuthority>getAuthorities()Returns the authorities granted to the user.java.lang.StringgetPassword()Returns the password used to authenticate the user.java.lang.StringgetUsername()Returns the username used to authenticate the user.booleanisAccountNonExpired()Indicates whether the user's account has expired.booleanisAccountNonLocked()Indicates whether the user is locked or unlocked.booleanisCredentialsNonExpired()Indicates whether the user's credentials (password) has expired.booleanisEnabled()Indicates whether the user is enabled or disabled.
-
-
-
Method Detail
-
getAuthorities
java.util.Collection<? extends GrantedAuthority> getAuthorities()
Returns the authorities granted to the user. Cannot returnnull.- Returns:
- the authorities, sorted by natural key (never
null)
-
getPassword
java.lang.String getPassword()
Returns the password used to authenticate the user.- Returns:
- the password
-
getUsername
java.lang.String getUsername()
Returns the username used to authenticate the user. Cannot returnnull.- Returns:
- the username (never
null)
-
isAccountNonExpired
boolean isAccountNonExpired()
Indicates whether the user's account has expired. An expired account cannot be authenticated.- Returns:
trueif the user's account is valid (ie non-expired),falseif no longer valid (ie expired)
-
isAccountNonLocked
boolean isAccountNonLocked()
Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.- Returns:
trueif the user is not locked,falseotherwise
-
isCredentialsNonExpired
boolean isCredentialsNonExpired()
Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.- Returns:
trueif the user's credentials are valid (ie non-expired),falseif no longer valid (ie expired)
-
isEnabled
boolean isEnabled()
Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.- Returns:
trueif the user is enabled,falseotherwise
-
-