UserDto.java
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.daeucna.board.security.domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ToString
public class UserDto implements UserDetails {
String ROLE_PREFIX = "ROLE_";
private String id;
private String password;
private String role;
@Getter @Setter
private String boardName;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority(ROLE_PREFIX + role));
return authorities;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return id;
}
// 계정 만료 여부(true: 만료되지 않음, false: 만료됨)
@Override
public boolean isAccountNonExpired() {
return false;
}
// 계정 잠금 여부(true: 계정잠금아님, false: 계정잠금상태)
@Override
public boolean isAccountNonLocked() {
return false;
}
// 계정 패스워드 만료 여부(true: 만료되지 않음, false: 만료됨)
@Override
public boolean isCredentialsNonExpired() {
return false;
}
// 계정 사용가능 여부(true: 사용가능, false: 사용불가능)
@Override
public boolean isEnabled() {
return false;
}
}