feat: 支持第三方账号登录

Just Auth(开箱即用的整合第三方登录的开源组件,脱离繁琐的第三方登录 SDK,让登录变得 So easy!)
This commit is contained in:
2023-10-14 23:58:13 +08:00
parent 71e20e9f84
commit 05cb609780
41 changed files with 826 additions and 49 deletions

View File

@@ -53,8 +53,9 @@ public class LoginHelper {
*
* @param loginUser
* 登录用户信息
* @return 令牌
*/
public static void login(LoginUser loginUser) {
public static String login(LoginUser loginUser) {
// 记录登录信息
HttpServletRequest request = ServletUtils.getRequest();
loginUser.setClientIp(ServletUtil.getClientIP(request));
@@ -65,8 +66,10 @@ public class LoginHelper {
// 登录并缓存用户信息
StpUtil.login(loginUser.getId());
SaHolder.getStorage().set(CacheConsts.LOGIN_USER_KEY, loginUser);
loginUser.setToken(StpUtil.getTokenValue());
String tokenValue = StpUtil.getTokenValue();
loginUser.setToken(tokenValue);
StpUtil.getTokenSession().set(CacheConsts.LOGIN_USER_KEY, loginUser);
return tokenValue;
}
/**