public interface UserDetails extends Serializable { /** * Returns the authorities granted to the user. Cannot return <code>null</code>. * @return the authorities, sorted by natural key (never <code>null</code>) */ Collection<? extends GrantedAuthority> getAuthorities(); /** * Returns the password used to authenticate the user. * @return the password */ String getPassword(); /** * Returns the username used to authenticate the user. Cannot return * <code>null</code>. * @return the username (never <code>null</code>) */ String getUsername(); /** * Indicates whether the user's account has expired. An expired account cannot be * authenticated. * @return <code>true</code> if the user's account is valid (ie non-expired), * <code>false</code> if no longer valid (ie expired) */ boolean isAccountNonExpired(); /** * Indicates whether the user is locked or unlocked. A locked user cannot be * authenticated. * @return <code>true</code> if the user is not locked, <code>false</code> otherwise */ boolean isAccountNonLocked(); /** * Indicates whether the user's credentials (password) has expired. Expired * credentials prevent authentication. * @return <code>true</code> if the user's credentials are valid (ie non-expired), * <code>false</code> if no longer valid (ie expired) */ boolean isCredentialsNonExpired(); /** * Indicates whether the user is enabled or disabled. A disabled user cannot be * authenticated. * @return <code>true</code> if the user is enabled, <code>false</code> otherwise */ boolean isEnabled(); }
时间: 2023-06-25 18:04:09 浏览: 79
userDetail
这是一个 Java 接口,名为 UserDetails,用于表示用户的详细信息。它包含了以下方法:
1. getAuthorities() 返回授予用户的权限集合。
2. getPassword() 返回用户用于身份验证的密码。
3. getUsername() 返回用户用于身份验证的用户名。
4. isAccountNonExpired() 指示用户的帐户是否已过期。
5. isAccountNonLocked() 指示用户是否已被锁定。
6. isCredentialsNonExpired() 指示用户的凭据(密码)是否已过期。
7. isEnabled() 指示用户是否已启用。
阅读全文