xiangpei
2025-04-18 ccadf9480d4e6a9dcc227a2a0b1f9ae0612e36fd
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.monkeylessey.sys.domain.vo;
 
 
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
 
import java.util.Collection;
import java.util.Set;
 
/**
 * @author 29443
 * @date 2022/4/5
 */
@Data
public class LoginUser implements UserDetails {
 
    /**
     * 用户ID
     */
    private String userId;
 
    /**
     * 部门ID
     */
    private Long deptId;
 
    /**
     * 用户唯一标识
     */
    private String token;
 
    /**
     * 登录时间
     */
    private Long loginTime;
 
    /**
     * 过期时间
     */
    private Long expireTime;
 
    /**
     * 登录IP地址
     */
    private String ipaddr;
 
    /**
     * 登录地点
     */
    private String loginLocation;
 
    /**
     * 浏览器类型
     */
    private String browser;
 
    /**
     * 操作系统
     */
    private String os;
 
    /**
     * 权限列表
     */
    private Set<GrantedAuthority> authorities;
 
    /**
     * 用户信息
     */
    private SysUserVO user;
 
    public LoginUser(String userId, SysUserVO user)
    {
        this.userId = userId;
        this.user = user;
    }
 
 
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }
 
    @Override
    public String getPassword() {
        return user.getPassword();
    }
 
    @Override
    public String getUsername() {
        return user.getUserName();
    }
 
    /** 返回用戶没过期 */
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }
 
    /** 用户没有过期 */
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }
 
    /** 密码没有过期 */
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
 
    /** 用户可用 */
    @Override
    public boolean isEnabled() {
        return true;
    }
}