This commit is contained in:
parent
f45442e954
commit
0e5e73be26
4
pom.xml
4
pom.xml
@ -91,8 +91,8 @@
|
||||
<properties>
|
||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||
<profiles.active>dev</profiles.active>
|
||||
<nacos.server>192.168.24.101:8848</nacos.server>
|
||||
<logstash.address>192.168.24.101:4560</logstash.address>
|
||||
<nacos.server>by.missmoc.top:8848</nacos.server>
|
||||
<logstash.address>by.missmoc.top:4560</logstash.address>
|
||||
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
||||
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
||||
<nacos.username>nacos</nacos.username>
|
||||
|
@ -1,10 +1,14 @@
|
||||
package org.dromara.auth.controller;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jodd.bean.BeanUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
@ -37,12 +41,14 @@ import org.dromara.system.api.RemoteSocialService;
|
||||
import org.dromara.system.api.RemoteTenantService;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteTenantVo;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -104,9 +110,17 @@ public class TokenController {
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
remoteMessageService.publishMessage(List.of(userId), "欢迎登录RuoYi-Cloud-Plus微服务管理系统");
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
if (loginBody.getRetUrl()!=null){
|
||||
return R.f(loginBody.getRetUrl()+"?token="+loginVo.getAccessToken());
|
||||
}
|
||||
return R.ok(loginVo);
|
||||
}
|
||||
|
||||
@RequestMapping("/token/check")
|
||||
public R<LoginUser> checkToken(String token) {
|
||||
return R.ok(LoginHelper.getLoginUser(token));
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方登录请求
|
||||
*
|
||||
|
@ -1,8 +1,14 @@
|
||||
package org.dromara.auth.service;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
||||
import org.dromara.auth.domain.vo.LoginVo;
|
||||
import org.dromara.auth.form.PasswordLoginBody;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.ValidatorUtils;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.api.domain.vo.RemoteClientVo;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,11 @@ public class R<T> implements Serializable {
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
*/
|
||||
public static final int FORBIDDEN = 403;
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
@ -43,6 +48,9 @@ public class R<T> implements Serializable {
|
||||
* 数据对象
|
||||
*/
|
||||
private T data;
|
||||
public static <T> R<T> f(String url) {
|
||||
return restResult(null, FORBIDDEN, url);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok() {
|
||||
return restResult(null, SUCCESS, "操作成功");
|
||||
|
@ -40,4 +40,9 @@ public class LoginBody {
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
private String retUrl;
|
||||
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ spring.sql.init.platform=mysql
|
||||
db.num=1
|
||||
|
||||
### Connect URL of DB:
|
||||
db.url.0=jdbc:mysql://47.109.37.87:3002/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.user.0=by
|
||||
db.password.0=123456
|
||||
db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.user.0=root
|
||||
db.password.0=root
|
||||
|
||||
### the maximum retry times for push
|
||||
nacos.config.push.maxRetryTime=50
|
||||
|
Loading…
Reference in New Issue
Block a user