parent
786bbf8622
commit
c9a4b9c5a1
3 changed files with 37 additions and 15 deletions
@ -1,14 +1,46 @@ |
||||
package cc.bnblogs.springinit.pojo; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springframework.security.core.GrantedAuthority; |
||||
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.Collections; |
||||
|
||||
@Data |
||||
@TableName("users") |
||||
public class MyUser { |
||||
public class MyUser implements UserDetails { |
||||
// 用户表中的字段如下
|
||||
@TableId |
||||
private Long id; |
||||
private String username; |
||||
private String password; |
||||
private Boolean enabled; |
||||
|
||||
// UserDetails接口需要实现的方法
|
||||
@Override |
||||
public Collection<? extends GrantedAuthority> getAuthorities() { |
||||
return Collections.emptyList(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isAccountNonExpired() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isAccountNonLocked() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isCredentialsNonExpired() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isEnabled() { |
||||
return true; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue