inleft
2022-02-21 a9c4c99791e4d43971afd863946a2b0c4db44708
commit | author | age
9bcb19 1 /*
I 2 Copyright [2020] [https://www.xiaonuo.vip]
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
17
18 1.请不要删除和修改根目录下的LICENSE文件。
19 2.请不要删除和修改Snowy源码头部的版权声明。
20 3.请保留源码和相关描述文件的项目出处,作者声明等。
21 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
22 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
23 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
24  */
25 package vip.xiaonuo.sys.modular.auth.service;
26
27 import org.springframework.security.core.Authentication;
28 import vip.xiaonuo.core.pojo.login.SysLoginUser;
29 import vip.xiaonuo.sys.modular.user.entity.SysUser;
30
31 import javax.servlet.http.HttpServletRequest;
32
33 /**
34  * 认证相关service
35  *
36  * @author xuyuxiang
37  * @date 2020/3/11 14:14
38  */
39 public interface AuthService {
40
41     /**
42      * 账号密码登录
43      *
44      * @param account  账号
45      * @param password 密码
46      * @return token
47      * @author xuyuxiang
48      * @date 2020/3/11 15:57
49      */
50     String login(String account, String password);
51
52     /**
53      * 根据已有用户信息登录
54      *
55      * @param sysUser 用户信息
56      * @return token
57      * @author xuyuxiang
58      * @date 2020/7/29 10:12
59      **/
60     String doLogin(SysUser sysUser);
61
62     /**
63      * 从request获取token
64      *
65      * @param request request
66      * @return token
67      * @author xuyuxiang
68      * @date 2020/3/13 11:41
69      */
70     String getTokenFromRequest(HttpServletRequest request);
71
72     /**
73      * 根据token获取登录用户信息
74      *
75      * @param token token
76      * @return 当前登陆的用户信息
77      * @author xuyuxiang
78      * @date 2020/3/13 11:59
79      */
80     SysLoginUser getLoginUserByToken(String token);
81
82     /**
83      * 退出登录
84      *
85      * @author xuyuxiang
86      * @date 2020/3/16 15:03
87      */
88     void logout();
89
90     /**
91      * 设置SpringSecurityContext上下文,方便获取用户
92      *
93      * @param sysLoginUser 当前登录用户信息
94      * @author xuyuxiang
95      * @date 2020/3/19 19:59
96      */
97     void setSpringSecurityContextAuthentication(SysLoginUser sysLoginUser);
98
99     /**
100      * 获取SpringSecurityContext中认证信息
101      *
102      * @return 认证信息
103      * @author xuyuxiang
104      * @date 2020/3/19 20:02
105      */
106     Authentication getAuthentication();
107
108     /**
109      * 校验token是否正确
110      *
111      * @param token token
112      * @author xuyuxiang
113      * @date 2020/5/28 9:57
114      */
115     void checkToken(String token);
116
117     /**
118      * 临时缓存租户信息
119      *
120      * @param tenantCode 多租户编码
121      * @author xuyuxiang
122      * @date 2020/9/3 21:22
123      */
124     void cacheTenantInfo(String tenantCode);
125
126     /**
127      * 根据系统用户构造用户登陆信息
128      *
129      * @param sysUser 系统用户
130      * @return 用户信息
131      * @author xuyuxiang
132      * @date 2020/9/20 15:21
133      **/
134     SysLoginUser genSysLoginUser(SysUser sysUser);
135
136     /**
137      * 新增用户的数据授权范围
138      *
139      * @author yubaoshan
140      * @date 2021/7/20 14:50
141      */
142     void refreshUserDataScope(Long orgId);
143
144 }