去除powerjob和第三方登录
This commit is contained in:
parent
91fee9f095
commit
afc24f9062
|
@ -6,22 +6,14 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.zhyd.oauth.model.AuthResponse;
|
|
||||||
import me.zhyd.oauth.model.AuthUser;
|
|
||||||
import me.zhyd.oauth.request.AuthRequest;
|
|
||||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
|
||||||
import org.dromara.common.core.constant.UserConstants;
|
import org.dromara.common.core.constant.UserConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.domain.model.LoginBody;
|
import org.dromara.common.core.domain.model.LoginBody;
|
||||||
import org.dromara.common.core.domain.model.RegisterBody;
|
import org.dromara.common.core.domain.model.RegisterBody;
|
||||||
import org.dromara.common.core.domain.model.SocialLoginBody;
|
|
||||||
import org.dromara.common.core.utils.*;
|
import org.dromara.common.core.utils.*;
|
||||||
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
|
||||||
import org.dromara.common.social.utils.SocialUtils;
|
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||||
import org.dromara.system.domain.SysClient;
|
import org.dromara.system.domain.SysClient;
|
||||||
|
@ -57,7 +49,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
@RequestMapping("/auth")
|
@RequestMapping("/auth")
|
||||||
public class AuthController {
|
public class AuthController {
|
||||||
|
|
||||||
private final SocialProperties socialProperties;
|
|
||||||
private final SysLoginService loginService;
|
private final SysLoginService loginService;
|
||||||
private final SysRegisterService registerService;
|
private final SysRegisterService registerService;
|
||||||
private final ISysConfigService configService;
|
private final ISysConfigService configService;
|
||||||
|
@ -101,45 +92,6 @@ public class AuthController {
|
||||||
return R.ok(loginVo);
|
return R.ok(loginVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 第三方登录请求
|
|
||||||
*
|
|
||||||
* @param source 登录来源
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@GetMapping("/binding/{source}")
|
|
||||||
public R<String> authBinding(@PathVariable("source") String source) {
|
|
||||||
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
|
||||||
if (ObjectUtil.isNull(obj)) {
|
|
||||||
return R.fail(source + "平台账号暂不支持");
|
|
||||||
}
|
|
||||||
AuthRequest authRequest = SocialUtils.getAuthRequest(source, socialProperties);
|
|
||||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
|
||||||
return R.ok("操作成功", authorizeUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 第三方登录回调业务处理 绑定授权
|
|
||||||
*
|
|
||||||
* @param loginBody 请求体
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/social/callback")
|
|
||||||
public R<Void> socialCallback(@RequestBody SocialLoginBody loginBody) {
|
|
||||||
// 获取第三方登录信息
|
|
||||||
AuthResponse<AuthUser> response = SocialUtils.loginAuth(
|
|
||||||
loginBody.getSource(), loginBody.getSocialCode(),
|
|
||||||
loginBody.getSocialState(), socialProperties);
|
|
||||||
AuthUser authUserData = response.getData();
|
|
||||||
// 判断授权响应是否成功
|
|
||||||
if (!response.ok()) {
|
|
||||||
return R.fail(response.getMsg());
|
|
||||||
}
|
|
||||||
loginService.socialRegister(authUserData);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权
|
* 取消授权
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,131 +0,0 @@
|
||||||
package org.dromara.web.service.impl;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.SaLoginModel;
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import cn.hutool.http.Method;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import me.zhyd.oauth.model.AuthResponse;
|
|
||||||
import me.zhyd.oauth.model.AuthUser;
|
|
||||||
import org.dromara.common.core.domain.model.LoginUser;
|
|
||||||
import org.dromara.common.core.domain.model.SocialLoginBody;
|
|
||||||
import org.dromara.common.core.enums.UserStatus;
|
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
|
||||||
import org.dromara.common.core.exception.user.UserException;
|
|
||||||
import org.dromara.common.core.utils.ValidatorUtils;
|
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
|
||||||
import org.dromara.common.social.utils.SocialUtils;
|
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
|
||||||
import org.dromara.system.domain.SysClient;
|
|
||||||
import org.dromara.system.domain.SysUser;
|
|
||||||
import org.dromara.system.domain.vo.SysSocialVo;
|
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
|
||||||
import org.dromara.system.mapper.SysUserMapper;
|
|
||||||
import org.dromara.system.service.ISysSocialService;
|
|
||||||
import org.dromara.web.domain.vo.LoginVo;
|
|
||||||
import org.dromara.web.service.IAuthStrategy;
|
|
||||||
import org.dromara.web.service.SysLoginService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 第三方授权策略
|
|
||||||
*
|
|
||||||
* @author thiszhc is 三三
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service("social" + IAuthStrategy.BASE_NAME)
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SocialAuthStrategy implements IAuthStrategy {
|
|
||||||
|
|
||||||
private final SocialProperties socialProperties;
|
|
||||||
private final ISysSocialService sysSocialService;
|
|
||||||
private final SysUserMapper userMapper;
|
|
||||||
private final SysLoginService loginService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录-第三方授权登录
|
|
||||||
*
|
|
||||||
* @param body 登录信息
|
|
||||||
* @param client 客户端信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public LoginVo login(String body, SysClient client) {
|
|
||||||
SocialLoginBody loginBody = JsonUtils.parseObject(body, SocialLoginBody.class);
|
|
||||||
ValidatorUtils.validate(loginBody);
|
|
||||||
AuthResponse<AuthUser> response = SocialUtils.loginAuth(
|
|
||||||
loginBody.getSource(), loginBody.getSocialCode(),
|
|
||||||
loginBody.getSocialState(), socialProperties);
|
|
||||||
if (!response.ok()) {
|
|
||||||
throw new ServiceException(response.getMsg());
|
|
||||||
}
|
|
||||||
AuthUser authUserData = response.getData();
|
|
||||||
if ("GITEE".equals(authUserData.getSource())) {
|
|
||||||
// 如用户使用 gitee 登录顺手 star 给作者一点支持 拒绝白嫖
|
|
||||||
HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Vue-Plus")
|
|
||||||
.formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken()))
|
|
||||||
.executeAsync();
|
|
||||||
HttpUtil.createRequest(Method.PUT, "https://gitee.com/api/v5/user/starred/dromara/RuoYi-Cloud-Plus")
|
|
||||||
.formStr(MapUtil.of("access_token", authUserData.getToken().getAccessToken()))
|
|
||||||
.executeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SysSocialVo> list = sysSocialService.selectByAuthId(authUserData.getSource() + authUserData.getUuid());
|
|
||||||
if (CollUtil.isEmpty(list)) {
|
|
||||||
throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!");
|
|
||||||
}
|
|
||||||
Optional<SysSocialVo> opt = list.stream().filter(x -> x.getTenantId().equals(loginBody.getTenantId())).findAny();
|
|
||||||
if (opt.isEmpty()) {
|
|
||||||
throw new ServiceException("对不起,你没有权限登录当前租户!");
|
|
||||||
}
|
|
||||||
SysSocialVo social = opt.get();
|
|
||||||
// 查找用户
|
|
||||||
SysUserVo user = loadUser(social.getTenantId(), social.getUserId());
|
|
||||||
|
|
||||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
|
||||||
LoginUser loginUser = loginService.buildLoginUser(user);
|
|
||||||
loginUser.setClientKey(client.getClientKey());
|
|
||||||
loginUser.setDeviceType(client.getDeviceType());
|
|
||||||
SaLoginModel model = new SaLoginModel();
|
|
||||||
model.setDevice(client.getDeviceType());
|
|
||||||
// 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置
|
|
||||||
// 例如: 后台用户30分钟过期 app用户1天过期
|
|
||||||
model.setTimeout(client.getTimeout());
|
|
||||||
model.setActiveTimeout(client.getActiveTimeout());
|
|
||||||
model.setExtra(LoginHelper.CLIENT_KEY, client.getClientId());
|
|
||||||
// 生成token
|
|
||||||
LoginHelper.login(loginUser, model);
|
|
||||||
|
|
||||||
LoginVo loginVo = new LoginVo();
|
|
||||||
loginVo.setAccessToken(StpUtil.getTokenValue());
|
|
||||||
loginVo.setExpireIn(StpUtil.getTokenTimeout());
|
|
||||||
loginVo.setClientId(client.getClientId());
|
|
||||||
return loginVo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SysUserVo loadUser(String tenantId, Long userId) {
|
|
||||||
return TenantHelper.dynamic(tenantId, () -> {
|
|
||||||
SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
||||||
.select(SysUser::getUserName, SysUser::getStatus)
|
|
||||||
.eq(SysUser::getUserId, userId));
|
|
||||||
if (ObjectUtil.isNull(user)) {
|
|
||||||
log.info("登录用户:{} 不存在.", "");
|
|
||||||
throw new UserException("user.not.exists", "");
|
|
||||||
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
|
||||||
log.info("登录用户:{} 已被停用.", "");
|
|
||||||
throw new UserException("user.blocked", "");
|
|
||||||
}
|
|
||||||
return userMapper.selectUserByUserName(user.getUserName());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-common-bom</module>
|
<module>ruoyi-common-bom</module>
|
||||||
<module>ruoyi-common-social</module>
|
|
||||||
<module>ruoyi-common-core</module>
|
<module>ruoyi-common-core</module>
|
||||||
<module>ruoyi-common-doc</module>
|
<module>ruoyi-common-doc</module>
|
||||||
<module>ruoyi-common-excel</module>
|
<module>ruoyi-common-excel</module>
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>ruoyi-common-social</artifactId>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
ruoyi-common-social 授权认证
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.zhyd.oauth</groupId>
|
|
||||||
<artifactId>JustAuth</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-json</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,23 +0,0 @@
|
||||||
package org.dromara.common.social.config;
|
|
||||||
|
|
||||||
import me.zhyd.oauth.cache.AuthStateCache;
|
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
|
||||||
import org.dromara.common.social.utils.AuthRedisStateCache;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Social 配置属性
|
|
||||||
* @author thiszhc
|
|
||||||
*/
|
|
||||||
@AutoConfiguration
|
|
||||||
@EnableConfigurationProperties(SocialProperties.class)
|
|
||||||
public class SocialAutoConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthStateCache authStateCache() {
|
|
||||||
return new AuthRedisStateCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
package org.dromara.common.social.config.properties;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社交登录配置
|
|
||||||
*
|
|
||||||
* @author thiszhc
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SocialLoginConfigProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用 ID
|
|
||||||
*/
|
|
||||||
private String clientId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用密钥
|
|
||||||
*/
|
|
||||||
private String clientSecret;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回调地址
|
|
||||||
*/
|
|
||||||
private String redirectUri;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否获取unionId
|
|
||||||
*/
|
|
||||||
private boolean unionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Coding 企业名称
|
|
||||||
*/
|
|
||||||
private String codingGroupName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付宝公钥
|
|
||||||
*/
|
|
||||||
private String alipayPublicKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业微信应用ID
|
|
||||||
*/
|
|
||||||
private String agentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* stackoverflow api key
|
|
||||||
*/
|
|
||||||
private String stackOverflowKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备ID
|
|
||||||
*/
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户端系统类型
|
|
||||||
*/
|
|
||||||
private String clientOsType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* maxkey 服务器地址
|
|
||||||
*/
|
|
||||||
private String serverUrl;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package org.dromara.common.social.config.properties;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Social 配置属性
|
|
||||||
*
|
|
||||||
* @author thiszhc
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "justauth")
|
|
||||||
public class SocialProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否启用
|
|
||||||
*/
|
|
||||||
private Boolean enabled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 授权类型
|
|
||||||
*/
|
|
||||||
private Map<String, SocialLoginConfigProperties> type;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
package org.dromara.common.social.maxkey;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Dict;
|
|
||||||
import me.zhyd.oauth.cache.AuthStateCache;
|
|
||||||
import me.zhyd.oauth.config.AuthConfig;
|
|
||||||
import me.zhyd.oauth.exception.AuthException;
|
|
||||||
import me.zhyd.oauth.model.AuthCallback;
|
|
||||||
import me.zhyd.oauth.model.AuthToken;
|
|
||||||
import me.zhyd.oauth.model.AuthUser;
|
|
||||||
import me.zhyd.oauth.request.AuthDefaultRequest;
|
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 长春叭哥 2023年03月26日
|
|
||||||
*/
|
|
||||||
public class AuthMaxKeyRequest extends AuthDefaultRequest {
|
|
||||||
|
|
||||||
public static final String SERVER_URL = SpringUtils.getProperty("justauth.type.maxkey.server-url");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设定归属域
|
|
||||||
*/
|
|
||||||
public AuthMaxKeyRequest(AuthConfig config) {
|
|
||||||
super(config, AuthMaxKeySource.MAXKEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthMaxKeyRequest(AuthConfig config, AuthStateCache authStateCache) {
|
|
||||||
super(config, AuthMaxKeySource.MAXKEY, authStateCache);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
|
||||||
String body = doPostAuthorizationCode(authCallback.getCode());
|
|
||||||
Dict object = JsonUtils.parseMap(body);
|
|
||||||
// oauth/token 验证异常
|
|
||||||
if (object.containsKey("error")) {
|
|
||||||
throw new AuthException(object.getStr("error_description"));
|
|
||||||
}
|
|
||||||
// user 验证异常
|
|
||||||
if (object.containsKey("message")) {
|
|
||||||
throw new AuthException(object.getStr("message"));
|
|
||||||
}
|
|
||||||
return AuthToken.builder()
|
|
||||||
.accessToken(object.getStr("access_token"))
|
|
||||||
.refreshToken(object.getStr("refresh_token"))
|
|
||||||
.idToken(object.getStr("id_token"))
|
|
||||||
.tokenType(object.getStr("token_type"))
|
|
||||||
.scope(object.getStr("scope"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
|
||||||
String body = doGetUserInfo(authToken);
|
|
||||||
Dict object = JsonUtils.parseMap(body);
|
|
||||||
// oauth/token 验证异常
|
|
||||||
if (object.containsKey("error")) {
|
|
||||||
throw new AuthException(object.getStr("error_description"));
|
|
||||||
}
|
|
||||||
// user 验证异常
|
|
||||||
if (object.containsKey("message")) {
|
|
||||||
throw new AuthException(object.getStr("message"));
|
|
||||||
}
|
|
||||||
return AuthUser.builder()
|
|
||||||
.uuid(object.getStr("userId"))
|
|
||||||
.username(object.getStr("username"))
|
|
||||||
.nickname(object.getStr("displayName"))
|
|
||||||
.avatar(object.getStr("avatar_url"))
|
|
||||||
.blog(object.getStr("web_url"))
|
|
||||||
.company(object.getStr("organization"))
|
|
||||||
.location(object.getStr("location"))
|
|
||||||
.email(object.getStr("email"))
|
|
||||||
.remark(object.getStr("bio"))
|
|
||||||
.token(authToken)
|
|
||||||
.source(source.toString())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package org.dromara.common.social.maxkey;
|
|
||||||
|
|
||||||
import me.zhyd.oauth.config.AuthSource;
|
|
||||||
import me.zhyd.oauth.request.AuthDefaultRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Oauth2 默认接口说明
|
|
||||||
*
|
|
||||||
* @author 长春叭哥 2023年03月26日
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum AuthMaxKeySource implements AuthSource {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自己搭建的 maxkey 私服
|
|
||||||
*/
|
|
||||||
MAXKEY {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 授权的api
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String authorize() {
|
|
||||||
return AuthMaxKeyRequest.SERVER_URL + "/sign/authz/oauth/v20/authorize";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取accessToken的api
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String accessToken() {
|
|
||||||
return AuthMaxKeyRequest.SERVER_URL + "/sign/authz/oauth/v20/token";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户信息的api
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String userInfo() {
|
|
||||||
return AuthMaxKeyRequest.SERVER_URL + "/sign/api/oauth/v20/me";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台对应的 AuthRequest 实现类,必须继承自 {@link AuthDefaultRequest}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Class<? extends AuthDefaultRequest> getTargetClass() {
|
|
||||||
return AuthMaxKeyRequest.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
package org.dromara.common.social.utils;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import me.zhyd.oauth.cache.AuthStateCache;
|
|
||||||
import org.dromara.common.core.constant.GlobalConstants;
|
|
||||||
import org.dromara.common.redis.utils.RedisUtils;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 授权状态缓存
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class AuthRedisStateCache implements AuthStateCache {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存入缓存
|
|
||||||
*
|
|
||||||
* @param key 缓存key
|
|
||||||
* @param value 缓存内容
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void cache(String key, String value) {
|
|
||||||
// 授权超时时间 默认三分钟
|
|
||||||
RedisUtils.setCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key, value, Duration.ofMinutes(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存入缓存
|
|
||||||
*
|
|
||||||
* @param key 缓存key
|
|
||||||
* @param value 缓存内容
|
|
||||||
* @param timeout 指定缓存过期时间(毫秒)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void cache(String key, String value, long timeout) {
|
|
||||||
RedisUtils.setCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key, value, Duration.ofMillis(timeout));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取缓存内容
|
|
||||||
*
|
|
||||||
* @param key 缓存key
|
|
||||||
* @return 缓存内容
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String get(String key) {
|
|
||||||
return RedisUtils.getCacheObject(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在key,如果对应key的value值已过期,也返回false
|
|
||||||
*
|
|
||||||
* @param key 缓存key
|
|
||||||
* @return true:存在key,并且value没过期;false:key不存在或者已过期
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean containsKey(String key) {
|
|
||||||
return RedisUtils.hasKey(GlobalConstants.SOCIAL_AUTH_CODE_KEY + key);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
package org.dromara.common.social.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import me.zhyd.oauth.config.AuthConfig;
|
|
||||||
import me.zhyd.oauth.exception.AuthException;
|
|
||||||
import me.zhyd.oauth.model.AuthCallback;
|
|
||||||
import me.zhyd.oauth.model.AuthResponse;
|
|
||||||
import me.zhyd.oauth.model.AuthUser;
|
|
||||||
import me.zhyd.oauth.request.*;
|
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
|
||||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
|
||||||
import org.dromara.common.social.maxkey.AuthMaxKeyRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 认证授权工具类
|
|
||||||
*
|
|
||||||
* @author thiszhc
|
|
||||||
*/
|
|
||||||
public class SocialUtils {
|
|
||||||
|
|
||||||
private static final AuthRedisStateCache STATE_CACHE = SpringUtils.getBean(AuthRedisStateCache.class);
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static AuthResponse<AuthUser> loginAuth(String source, String code, String state, SocialProperties socialProperties) throws AuthException {
|
|
||||||
AuthRequest authRequest = getAuthRequest(source, socialProperties);
|
|
||||||
AuthCallback callback = new AuthCallback();
|
|
||||||
callback.setCode(code);
|
|
||||||
callback.setState(state);
|
|
||||||
return authRequest.login(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AuthRequest getAuthRequest(String source, SocialProperties socialProperties) throws AuthException {
|
|
||||||
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
|
||||||
if (ObjectUtil.isNull(obj)) {
|
|
||||||
throw new AuthException("不支持的第三方登录类型");
|
|
||||||
}
|
|
||||||
AuthConfig.AuthConfigBuilder builder = AuthConfig.builder()
|
|
||||||
.clientId(obj.getClientId())
|
|
||||||
.clientSecret(obj.getClientSecret())
|
|
||||||
.redirectUri(obj.getRedirectUri());
|
|
||||||
return switch (source.toLowerCase()) {
|
|
||||||
case "dingtalk" -> new AuthDingTalkRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "baidu" -> new AuthBaiduRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "github" -> new AuthGithubRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "gitee" -> new AuthGiteeRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "weibo" -> new AuthWeiboRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "coding" -> new AuthCodingRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "oschina" -> new AuthOschinaRequest(builder.build(), STATE_CACHE);
|
|
||||||
// 支付宝在创建回调地址时,不允许使用localhost或者127.0.0.1,所以这儿的回调地址使用的局域网内的ip
|
|
||||||
case "alipay_wallet" -> new AuthAlipayRequest(builder.build(), socialProperties.getType().get("alipay_wallet").getAlipayPublicKey(), STATE_CACHE);
|
|
||||||
case "qq" -> new AuthQqRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "wechat_open" -> new AuthWeChatOpenRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "taobao" -> new AuthTaobaoRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "douyin" -> new AuthDouyinRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "linkedin" -> new AuthLinkedinRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "microsoft" -> new AuthMicrosoftRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "renren" -> new AuthRenrenRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "stack_overflow" -> new AuthStackOverflowRequest(builder.stackOverflowKey("").build(), STATE_CACHE);
|
|
||||||
case "huawei" -> new AuthHuaweiRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.agentId("").build(), STATE_CACHE);
|
|
||||||
case "gitlab" -> new AuthGitlabRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "wechat_mp" -> new AuthWeChatMpRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE);
|
|
||||||
case "maxkey" -> new AuthMaxKeyRequest(builder.build(), STATE_CACHE);
|
|
||||||
default -> throw new AuthException("未获取到有效的Auth配置");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
org.dromara.common.social.config.SocialAutoConfiguration
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>ruoyi-monitor-admin</module>
|
<module>ruoyi-monitor-admin</module>
|
||||||
<module>ruoyi-powerjob-server</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#FROM findepi/graalvm:java17-native
|
|
||||||
FROM openjdk:17.0.2-oraclelinux8
|
|
||||||
|
|
||||||
MAINTAINER Lion Li
|
|
||||||
|
|
||||||
RUN mkdir -p /ruoyi/powerjob/logs
|
|
||||||
|
|
||||||
WORKDIR /ruoyi/powerjob
|
|
||||||
|
|
||||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="-Xms512m -Xmx1024m"
|
|
||||||
|
|
||||||
EXPOSE 7700
|
|
||||||
|
|
||||||
ADD ./target/ruoyi-powerjob-server.jar ./app.jar
|
|
||||||
|
|
||||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -jar app.jar \
|
|
||||||
-XX:+HeapDumpOnOutOfMemoryError -Xlog:gc*,:time,tags,level -XX:+UseZGC ${JAVA_OPTS}
|
|
|
@ -1,68 +0,0 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<artifactId>ruoyi-powerjob-server</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<spring-boot.version>2.7.18</spring-boot.version>
|
|
||||||
<spring-boot-admin.version>2.7.11</spring-boot-admin.version>
|
|
||||||
</properties>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<!-- PowerJob server-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>tech.powerjob</groupId>
|
|
||||||
<artifactId>powerjob-server-starter</artifactId>
|
|
||||||
<version>${powerjob.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.codecentric</groupId>
|
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
|
||||||
<version>${spring-boot-admin.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,25 +0,0 @@
|
||||||
package org.dromara.powerjob;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
||||||
import tech.powerjob.server.common.utils.PropertyUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* powerjob 启动程序
|
|
||||||
*
|
|
||||||
* @author yhan219
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@EnableScheduling
|
|
||||||
@SpringBootApplication(scanBasePackages = "tech.powerjob.server")
|
|
||||||
public class PowerJobServerApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
PropertyUtils.init();
|
|
||||||
SpringApplication.run(tech.powerjob.server.PowerJobServerApplication.class, args);
|
|
||||||
log.info("文档地址: https://www.yuque.com/powerjob/guidence/problem");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
oms.env=dev
|
|
||||||
|
|
||||||
####### Database properties(Configure according to the the environment) #######
|
|
||||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
|
||||||
spring.datasource.core.username=root
|
|
||||||
spring.datasource.core.password=root
|
|
||||||
spring.datasource.core.maximum-pool-size=20
|
|
||||||
spring.datasource.core.minimum-idle=5
|
|
||||||
|
|
||||||
# 监控配置
|
|
||||||
# 客户端开关
|
|
||||||
spring.boot.admin.client.enabled=true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
spring.boot.admin.client.url: http://localhost:9090/admin
|
|
||||||
spring.boot.admin.client.instance.service-host-type=IP
|
|
||||||
spring.boot.admin.client.username=ruoyi
|
|
||||||
spring.boot.admin.client.password=123456
|
|
||||||
|
|
||||||
####### MongoDB properties(Non-core configuration properties) #######
|
|
||||||
####### delete mongodb config to disable mongodb #######
|
|
||||||
oms.mongodb.enable=false
|
|
||||||
#spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority
|
|
||||||
|
|
||||||
####### Email properties(Non-core configuration properties) #######
|
|
||||||
####### Delete the following code to disable the mail #######
|
|
||||||
#spring.mail.host=smtp.163.com
|
|
||||||
#spring.mail.username=zqq@163.com
|
|
||||||
#spring.mail.password=GOFZPNARMVKCGONV
|
|
||||||
#spring.mail.properties.mail.smtp.auth=true
|
|
||||||
#spring.mail.properties.mail.smtp.starttls.enable=true
|
|
||||||
#spring.mail.properties.mail.smtp.starttls.required=true
|
|
||||||
|
|
||||||
####### DingTalk properties(Non-core configuration properties) #######
|
|
||||||
####### Delete the following code to disable the DingTalk #######
|
|
||||||
#oms.alarm.ding.app-key=dingauqwkvxxnqskknfv
|
|
||||||
#oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl
|
|
||||||
#oms.alarm.ding.agent-id=847044348
|
|
||||||
|
|
||||||
####### Resource cleaning properties #######
|
|
||||||
oms.instanceinfo.retention=1
|
|
||||||
oms.container.retention.local=1
|
|
||||||
oms.container.retention.remote=-1
|
|
||||||
|
|
||||||
####### Cache properties #######
|
|
||||||
oms.instance.metadata.cache.size=1024
|
|
||||||
|
|
||||||
####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
|
|
||||||
####### split-brain could be avoided while performance overhead would increase. #######
|
|
||||||
oms.accurate.select.server.percentage = 50
|
|
|
@ -1,50 +0,0 @@
|
||||||
oms.env=prod
|
|
||||||
|
|
||||||
####### Database properties(Configure according to the the environment) #######
|
|
||||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
|
||||||
spring.datasource.core.username=root
|
|
||||||
spring.datasource.core.password=root
|
|
||||||
spring.datasource.core.maximum-pool-size=20
|
|
||||||
spring.datasource.core.minimum-idle=5
|
|
||||||
|
|
||||||
# 监控配置
|
|
||||||
# 客户端开关
|
|
||||||
spring.boot.admin.client.enabled=true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
spring.boot.admin.client.url: http://localhost:9090/admin
|
|
||||||
spring.boot.admin.client.instance.service-host-type=IP
|
|
||||||
spring.boot.admin.client.username=ruoyi
|
|
||||||
spring.boot.admin.client.password=123456
|
|
||||||
|
|
||||||
####### MongoDB properties(Non-core configuration properties) #######
|
|
||||||
####### delete mongodb config to disable mongodb #######
|
|
||||||
oms.mongodb.enable=false
|
|
||||||
#spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority
|
|
||||||
|
|
||||||
####### Email properties(Non-core configuration properties) #######
|
|
||||||
####### Delete the following code to disable the mail #######
|
|
||||||
#spring.mail.host=smtp.163.com
|
|
||||||
#spring.mail.username=zqq@163.com
|
|
||||||
#spring.mail.password=GOFZPNARMVKCGONV
|
|
||||||
#spring.mail.properties.mail.smtp.auth=true
|
|
||||||
#spring.mail.properties.mail.smtp.starttls.enable=true
|
|
||||||
#spring.mail.properties.mail.smtp.starttls.required=true
|
|
||||||
|
|
||||||
####### DingTalk properties(Non-core configuration properties) #######
|
|
||||||
####### Delete the following code to disable the DingTalk #######
|
|
||||||
#oms.alarm.ding.app-key=dingauqwkvxxnqskknfv
|
|
||||||
#oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl
|
|
||||||
#oms.alarm.ding.agent-id=847044348
|
|
||||||
|
|
||||||
####### Resource cleaning properties #######
|
|
||||||
oms.instanceinfo.retention=7
|
|
||||||
oms.container.retention.local=7
|
|
||||||
oms.container.retention.remote=-1
|
|
||||||
|
|
||||||
####### Cache properties #######
|
|
||||||
oms.instance.metadata.cache.size=2048
|
|
||||||
|
|
||||||
####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which #######
|
|
||||||
####### split-brain could be avoided while performance overhead would increase. #######
|
|
||||||
oms.accurate.select.server.percentage = 50
|
|
|
@ -1,33 +0,0 @@
|
||||||
# Http server port
|
|
||||||
server.port=7700
|
|
||||||
|
|
||||||
spring.profiles.active=@profiles.active@
|
|
||||||
spring.main.banner-mode=log
|
|
||||||
spring.jpa.open-in-view=false
|
|
||||||
spring.data.mongodb.repositories.type=none
|
|
||||||
logging.level.org.mongodb=warn
|
|
||||||
logging.level.tech.powerjob.server=warn
|
|
||||||
logging.level.MONITOR_LOGGER_DB_OPERATION=warn
|
|
||||||
logging.level.MONITOR_LOGGER_WORKER_HEART_BEAT=warn
|
|
||||||
logging.config: classpath:logback-plus.xml
|
|
||||||
|
|
||||||
# Configuration for uploading files.
|
|
||||||
spring.servlet.multipart.enabled=true
|
|
||||||
spring.servlet.multipart.file-size-threshold=0
|
|
||||||
spring.servlet.multipart.max-file-size=209715200
|
|
||||||
spring.servlet.multipart.max-request-size=209715200
|
|
||||||
|
|
||||||
###### PowerJob transporter configuration ######
|
|
||||||
oms.transporter.active.protocols=AKKA,HTTP
|
|
||||||
oms.transporter.main.protocol=HTTP
|
|
||||||
oms.akka.port=10086
|
|
||||||
oms.http.port=10010
|
|
||||||
# Prefix for all tables. Default empty string. Config if you have needs, i.e. pj_
|
|
||||||
oms.table-prefix=pj_
|
|
||||||
|
|
||||||
# Actuator 监控端点的配置项
|
|
||||||
spring.application.name: ruoyi-powerjob-server
|
|
||||||
management.endpoints.web.exposure.include=*
|
|
||||||
management.endpoint.health.show-details=ALWAYS
|
|
||||||
management.endpoint.logfile.external-file=./logs/ruoyi-powerjob-server.log
|
|
||||||
management.health.mongo.enabled=${oms.mongodb.enable}
|
|
|
@ -1,11 +0,0 @@
|
||||||
Application Version: ${revision}
|
|
||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
_ _
|
|
||||||
(_) | |
|
|
||||||
_ __ _____ _____ _ __ _ ___ | |__ ______ ___ ___ _ ____ _____ _ __
|
|
||||||
| '_ \ / _ \ \ /\ / / _ \ '__| |/ _ \| '_ \______/ __|/ _ \ '__\ \ / / _ \ '__|
|
|
||||||
| |_) | (_) \ V V / __/ | | | (_) | |_) | \__ \ __/ | \ V / __/ |
|
|
||||||
| .__/ \___/ \_/\_/ \___|_| | |\___/|_.__/ |___/\___|_| \_/ \___|_|
|
|
||||||
| | _/ |
|
|
||||||
|_| |__/
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="false" scan="true" scanPeriod="1 seconds">
|
|
||||||
|
|
||||||
<contextName>logback</contextName>
|
|
||||||
<property name="log.path" value="./logs/ruoyi-powerjob-server"/>
|
|
||||||
<property name="console.log.pattern"
|
|
||||||
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
|
||||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
|
||||||
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${console.log.pattern}</pattern>
|
|
||||||
<charset>utf-8</charset>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
<appender-ref ref="file"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
Loading…
Reference in New Issue