You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.8 KiB
73 lines
1.8 KiB
package com.aiprose.scauth.entity;
|
|
|
|
import com.alibaba.fastjson.annotation.JSONField;
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import lombok.Data;
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Transient;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author nelson
|
|
* @desc 用户表
|
|
* @company 北京中经网软件有限公司
|
|
* @date 2020/11/27 17:04
|
|
* @since 1.0
|
|
*/
|
|
@Data
|
|
@Entity
|
|
@Table(name="sys_user")
|
|
public class User extends IDEntity implements UserDetails {
|
|
@Column(unique = true)
|
|
private String username;
|
|
private String password;
|
|
|
|
/* 指示是否未过期的用户的凭据(密码),过期的凭据防止认证 默认true 默认表示未过期 */
|
|
@Transient
|
|
private boolean credentialsNonExpired = true;
|
|
|
|
//账户是否未过期,过期无法验证 默认true表示未过期
|
|
private boolean accountNonExpired = true;
|
|
|
|
//用户是未被锁定,锁定的用户无法进行身份验证 默认true表示未锁定
|
|
private boolean accountNonLocked = true;
|
|
|
|
//是否可用 ,禁用的用户不能身份验证 默认true表示可用
|
|
private boolean enabled = true;
|
|
|
|
@Transient
|
|
private List<Role> roles;
|
|
|
|
@JsonIgnore
|
|
@JSONField(serialize = false)
|
|
@Override
|
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
|
return roles;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonLocked() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCredentialsNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEnabled() {
|
|
return true;
|
|
}
|
|
}
|
|
|