添加 必要的注释

pull/1/MERGE
monkeyk7 7 years ago
parent 575db10d1b
commit 28b34b8b85

@ -19,13 +19,28 @@ public class WdcyUserDetails implements UserDetails {
private static final long serialVersionUID = 3957586021470480642L; private static final long serialVersionUID = 3957586021470480642L;
/**
*
*
* @see org.springframework.security.access.vote.RoleVoter
*/
protected static final String ROLE_PREFIX = "ROLE_"; protected static final String ROLE_PREFIX = "ROLE_";
/**
*
* ROLE_USER
*/
protected static final GrantedAuthority DEFAULT_USER_ROLE = new SimpleGrantedAuthority(ROLE_PREFIX + Privilege.USER.name()); protected static final GrantedAuthority DEFAULT_USER_ROLE = new SimpleGrantedAuthority(ROLE_PREFIX + Privilege.USER.name());
protected User user; protected User user;
/**
*
*/
protected List<GrantedAuthority> grantedAuthorities = new ArrayList<>(); protected List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
public WdcyUserDetails() { public WdcyUserDetails() {
} }
@ -34,6 +49,9 @@ public class WdcyUserDetails implements UserDetails {
initialAuthorities(); initialAuthorities();
} }
/**
* ,
*/
private void initialAuthorities() { private void initialAuthorities() {
//Default, everyone have it //Default, everyone have it
this.grantedAuthorities.add(DEFAULT_USER_ROLE); this.grantedAuthorities.add(DEFAULT_USER_ROLE);
@ -69,21 +87,25 @@ public class WdcyUserDetails implements UserDetails {
return user.username(); return user.username();
} }
/* 账户是否未过期 */
@Override @Override
public boolean isAccountNonExpired() { public boolean isAccountNonExpired() {
return true; return true;
} }
/*账户是否未锁定 */
@Override @Override
public boolean isAccountNonLocked() { public boolean isAccountNonLocked() {
return true; return true;
} }
/* 密码是否未过期 */
@Override @Override
public boolean isCredentialsNonExpired() { public boolean isCredentialsNonExpired() {
return true; return true;
} }
/*账户是否启用,默认true (启用)*/
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return true; return true;
@ -96,9 +118,9 @@ public class WdcyUserDetails implements UserDetails {
@Override @Override
public String toString() { public String toString() {
final StringBuilder sb = new StringBuilder(); return "{" +
sb.append("{user=").append(user); "user=" + user +
sb.append('}'); ", grantedAuthorities=" + grantedAuthorities +
return sb.toString(); '}';
} }
} }
Loading…
Cancel
Save