Blame view

src/main/java/com/daeucna/board/security/domain/UserDto.java 1.71 KB
a6468920   sangkiham   Spring Boot Board...
1
2
3
4
5
6
  package com.daeucna.board.security.domain;

  

  import java.util.ArrayList;

  import java.util.Collection;

  import java.util.List;

  

a6468920   sangkiham   Spring Boot Board...
7
8
9
10
11
12
13
14
15
16
17
  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 {

  

cb01f7b1   sangkiham   .
18
19
    private static final long serialVersionUID = -8756513459420668339L;

  

a6468920   sangkiham   Spring Boot Board...
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
70
    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;

    }

  

  }