69 lines
1.5 KiB
Java
69 lines
1.5 KiB
Java
package com.dbnt.kcgfilemanager.userInfo;
|
|
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.Setter;
|
|
import org.springframework.data.annotation.Id;
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Date;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
public class UserInfo implements UserDetails {
|
|
@Id
|
|
private int userSeq;
|
|
private String userId;
|
|
private String password;
|
|
private String name;
|
|
private int position;
|
|
private int department;
|
|
private String userRole;
|
|
private Date createDate;
|
|
|
|
@Override
|
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
|
Set<GrantedAuthority> roles = new HashSet<>();
|
|
for (String role : userRole.split(",")) {
|
|
roles.add(new SimpleGrantedAuthority(role));
|
|
}
|
|
return roles;
|
|
}
|
|
|
|
@Override
|
|
public String getPassword() {
|
|
return password;
|
|
}
|
|
|
|
@Override
|
|
public String getUsername() {
|
|
return userId;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonLocked() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCredentialsNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEnabled() {
|
|
return true;
|
|
}
|
|
}
|