forked from sfms3.0/sfms3.0
21 changed files with 13 additions and 762 deletions
@ -1,56 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<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/xsd/maven-4.0.0.xsd"> |
|
||||
<parent> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-framework</artifactId> |
|
||||
<version>${revision}</version> |
|
||||
</parent> |
|
||||
<packaging>jar</packaging> |
|
||||
<modelVersion>4.0.0</modelVersion> |
|
||||
|
|
||||
<artifactId>win-spring-boot-starter-biz-social</artifactId> |
|
||||
<name>${project.artifactId}</name> |
|
||||
|
|
||||
<dependencies> |
|
||||
<dependency> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-common</artifactId> |
|
||||
</dependency> |
|
||||
<!-- Spring 核心 --> |
|
||||
<dependency> |
|
||||
<groupId>org.springframework.boot</groupId> |
|
||||
<artifactId>spring-boot-starter-aop</artifactId> |
|
||||
</dependency> |
|
||||
<!-- Web 相关 --> |
|
||||
<dependency> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-spring-boot-starter-web</artifactId> |
|
||||
</dependency> |
|
||||
<!-- spring boot 配置所需依赖 --> |
|
||||
<dependency> |
|
||||
<groupId>org.springframework.boot</groupId> |
|
||||
<artifactId>spring-boot-configuration-processor</artifactId> |
|
||||
<optional>true</optional> |
|
||||
</dependency> |
|
||||
<!-- 三方云服务相关 --> |
|
||||
<dependency> |
|
||||
<groupId>com.xingyuv</groupId> |
|
||||
<artifactId>spring-boot-starter-justauth</artifactId> |
|
||||
<exclusions> |
|
||||
<exclusion> |
|
||||
<groupId>cn.hutool</groupId> |
|
||||
<artifactId>hutool-core</artifactId> |
|
||||
</exclusion> |
|
||||
</exclusions> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-spring-boot-starter-redis</artifactId> |
|
||||
</dependency> |
|
||||
|
|
||||
</dependencies> |
|
||||
|
|
||||
|
|
||||
</project> |
|
@ -1,36 +0,0 @@ |
|||||
package com.win.framework.social.config; |
|
||||
|
|
||||
import com.win.framework.social.core.WinAuthRequestFactory; |
|
||||
import com.xingyuv.http.HttpUtil; |
|
||||
import com.xingyuv.http.support.hutool.HutoolImpl; |
|
||||
import com.xingyuv.jushauth.cache.AuthStateCache; |
|
||||
import com.xingyuv.justauth.autoconfigure.JustAuthProperties; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|
||||
import org.springframework.context.annotation.Bean; |
|
||||
import org.springframework.context.annotation.Primary; |
|
||||
|
|
||||
/** |
|
||||
* 社交自动装配类 |
|
||||
* |
|
||||
* @author timfruit |
|
||||
* @date 2021-10-30 |
|
||||
*/ |
|
||||
@Slf4j |
|
||||
@AutoConfiguration |
|
||||
@EnableConfigurationProperties(JustAuthProperties.class) |
|
||||
public class WinSocialAutoConfiguration { |
|
||||
|
|
||||
@Bean |
|
||||
@Primary |
|
||||
@ConditionalOnProperty(prefix = "justauth", value = "enabled", havingValue = "true", matchIfMissing = true) |
|
||||
public WinAuthRequestFactory winAuthRequestFactory(JustAuthProperties properties, AuthStateCache authStateCache) { |
|
||||
// 需要修改 HttpUtil 使用的实现,避免类报错
|
|
||||
HttpUtil.setHttp(new HutoolImpl()); |
|
||||
// 创建 WinAuthRequestFactory
|
|
||||
return new WinAuthRequestFactory(properties, authStateCache); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,94 +0,0 @@ |
|||||
package com.win.framework.social.core; |
|
||||
|
|
||||
import cn.hutool.core.util.EnumUtil; |
|
||||
import cn.hutool.core.util.ReflectUtil; |
|
||||
import com.win.framework.social.core.enums.AuthExtendSource; |
|
||||
import com.win.framework.social.core.request.AuthWeChatMiniAppRequest; |
|
||||
import com.win.framework.social.core.request.AuthWeChatMpRequest; |
|
||||
import com.xingyuv.jushauth.cache.AuthStateCache; |
|
||||
import com.xingyuv.jushauth.config.AuthConfig; |
|
||||
import com.xingyuv.jushauth.config.AuthSource; |
|
||||
import com.xingyuv.jushauth.request.AuthRequest; |
|
||||
import com.xingyuv.justauth.AuthRequestFactory; |
|
||||
import com.xingyuv.justauth.autoconfigure.JustAuthProperties; |
|
||||
|
|
||||
import java.lang.reflect.Method; |
|
||||
|
|
||||
import static com.xingyuv.jushauth.config.AuthDefaultSource.WECHAT_MP; |
|
||||
|
|
||||
/** |
|
||||
* 第三方授权拓展 request 工厂类 |
|
||||
* 为使得拓展配置 {@link AuthConfig} 和默认配置齐平,所以自定义本工厂类 |
|
||||
* |
|
||||
* @author timfruit |
|
||||
* @date 2021-10-31 |
|
||||
*/ |
|
||||
public class WinAuthRequestFactory extends AuthRequestFactory { |
|
||||
|
|
||||
protected JustAuthProperties properties; |
|
||||
protected AuthStateCache authStateCache; |
|
||||
|
|
||||
/** |
|
||||
* 由于父类 configureHttpConfig 方法是 private 修饰,所以获取后,进行反射调用 |
|
||||
*/ |
|
||||
private final Method configureHttpConfigMethod = ReflectUtil.getMethod(AuthRequestFactory.class, |
|
||||
"configureHttpConfig", String.class, AuthConfig.class, JustAuthProperties.JustAuthHttpConfig.class); |
|
||||
|
|
||||
public WinAuthRequestFactory(JustAuthProperties properties, AuthStateCache authStateCache) { |
|
||||
super(properties, authStateCache); |
|
||||
this.properties = properties; |
|
||||
this.authStateCache = authStateCache; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回 AuthRequest 对象 |
|
||||
* |
|
||||
* @param source {@link AuthSource} |
|
||||
* @return {@link AuthRequest} |
|
||||
*/ |
|
||||
@Override |
|
||||
public AuthRequest get(String source) { |
|
||||
// 先尝试获取自定义扩展的
|
|
||||
AuthRequest authRequest = getExtendRequest(source); |
|
||||
// 找不到,使用默认拓展
|
|
||||
if (authRequest == null) { |
|
||||
authRequest = super.get(source); |
|
||||
} |
|
||||
return authRequest; |
|
||||
} |
|
||||
|
|
||||
protected AuthRequest getExtendRequest(String source) { |
|
||||
// TODO 芋艿:临时兼容 justauth 迁移的类型不对问题;
|
|
||||
if (WECHAT_MP.name().equalsIgnoreCase(source)) { |
|
||||
AuthConfig config = properties.getType().get(WECHAT_MP.name()); |
|
||||
return new AuthWeChatMpRequest(config, authStateCache); |
|
||||
} |
|
||||
|
|
||||
AuthExtendSource authExtendSource; |
|
||||
try { |
|
||||
authExtendSource = EnumUtil.fromString(AuthExtendSource.class, source.toUpperCase()); |
|
||||
} catch (IllegalArgumentException e) { |
|
||||
// 无自定义匹配
|
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
// 拓展配置和默认配置齐平,properties 放在一起
|
|
||||
AuthConfig config = properties.getType().get(authExtendSource.name()); |
|
||||
// 找不到对应关系,直接返回空
|
|
||||
if (config == null) { |
|
||||
return null; |
|
||||
} |
|
||||
// 反射调用,配置 http config
|
|
||||
ReflectUtil.invoke(this, configureHttpConfigMethod, authExtendSource.name(), config, properties.getHttpConfig()); |
|
||||
|
|
||||
// 获得拓展的 Request
|
|
||||
// noinspection SwitchStatementWithTooFewBranches
|
|
||||
switch (authExtendSource) { |
|
||||
case WECHAT_MINI_APP: |
|
||||
return new AuthWeChatMiniAppRequest(config, authStateCache); |
|
||||
default: |
|
||||
return null; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,45 +0,0 @@ |
|||||
package com.win.framework.social.core.enums; |
|
||||
|
|
||||
import com.xingyuv.jushauth.config.AuthSource; |
|
||||
import com.xingyuv.jushauth.request.AuthDefaultRequest; |
|
||||
|
|
||||
/** |
|
||||
* 拓展 JustAuth 各 api 需要的 url, 用枚举类分平台类型管理 |
|
||||
* |
|
||||
* 默认配置 {@link com.xingyuv.jushauth.config.AuthDefaultSource} |
|
||||
* |
|
||||
* @author timfruit |
|
||||
*/ |
|
||||
public enum AuthExtendSource implements AuthSource { |
|
||||
|
|
||||
/** |
|
||||
* 微信小程序授权登录 |
|
||||
*/ |
|
||||
WECHAT_MINI_APP { |
|
||||
|
|
||||
@Override |
|
||||
public String authorize() { |
|
||||
// 参见 https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html 文档
|
|
||||
throw new UnsupportedOperationException("不支持获取授权 url,请使用小程序内置函数 wx.login() 登录获取 code"); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public String accessToken() { |
|
||||
// 参见 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html 文档
|
|
||||
// 获取 openid, unionId , session_key 等字段
|
|
||||
return "https://api.weixin.qq.com/sns/jscode2session"; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public String userInfo() { |
|
||||
// 参见 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html 文档
|
|
||||
throw new UnsupportedOperationException("不支持获取用户信息 url,请使用小程序内置函数 wx.getUserProfile() 获取用户信息"); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public Class<? extends AuthDefaultRequest> getTargetClass() { |
|
||||
return null; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,97 +0,0 @@ |
|||||
package com.win.framework.social.core.request; |
|
||||
|
|
||||
import com.win.framework.common.util.json.JsonUtils; |
|
||||
import com.win.framework.social.core.enums.AuthExtendSource; |
|
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
|
||||
import com.xingyuv.jushauth.cache.AuthStateCache; |
|
||||
import com.xingyuv.jushauth.config.AuthConfig; |
|
||||
import com.xingyuv.jushauth.exception.AuthException; |
|
||||
import com.xingyuv.jushauth.model.AuthCallback; |
|
||||
import com.xingyuv.jushauth.model.AuthToken; |
|
||||
import com.xingyuv.jushauth.model.AuthUser; |
|
||||
import com.xingyuv.jushauth.request.AuthDefaultRequest; |
|
||||
import com.xingyuv.jushauth.utils.HttpUtils; |
|
||||
import com.xingyuv.jushauth.utils.UrlBuilder; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
/** |
|
||||
* 微信小程序登陆 Request 请求 |
|
||||
* |
|
||||
* 由于 JustAuth 定位是面向 Web 为主的三方登录,所以微信小程序只能自己封装 |
|
||||
* |
|
||||
* @author timfruit |
|
||||
* @date 2021-10-29 |
|
||||
*/ |
|
||||
public class AuthWeChatMiniAppRequest extends AuthDefaultRequest { |
|
||||
|
|
||||
public AuthWeChatMiniAppRequest(AuthConfig config, AuthStateCache authStateCache) { |
|
||||
super(config, AuthExtendSource.WECHAT_MINI_APP, authStateCache); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) { |
|
||||
// 参见 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html 文档
|
|
||||
// 使用 code 获取对应的 openId、unionId 等字段
|
|
||||
String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl(authCallback.getCode())).getBody(); |
|
||||
JSCode2SessionResponse accessTokenObject = JsonUtils.parseObject(response, JSCode2SessionResponse.class); |
|
||||
assert accessTokenObject != null; |
|
||||
checkResponse(accessTokenObject); |
|
||||
// 拼装结果
|
|
||||
return AuthToken.builder() |
|
||||
.openId(accessTokenObject.getOpenid()) |
|
||||
.unionId(accessTokenObject.getUnionId()) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected AuthUser getUserInfo(AuthToken authToken) { |
|
||||
// 参见 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html 文档
|
|
||||
// 如果需要用户信息,需要在小程序调用函数后传给后端
|
|
||||
return AuthUser.builder() |
|
||||
.username("") |
|
||||
.nickname("") |
|
||||
.avatar("") |
|
||||
.uuid(authToken.getOpenId()) |
|
||||
.token(authToken) |
|
||||
.source(source.toString()) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 检查响应内容是否正确 |
|
||||
* |
|
||||
* @param response 请求响应内容 |
|
||||
*/ |
|
||||
private void checkResponse(JSCode2SessionResponse response) { |
|
||||
if (response.getErrorCode() != 0) { |
|
||||
throw new AuthException(response.getErrorCode(), response.getErrorMsg()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected String accessTokenUrl(String code) { |
|
||||
return UrlBuilder.fromBaseUrl(source.accessToken()) |
|
||||
.queryParam("appid", config.getClientId()) |
|
||||
.queryParam("secret", config.getClientSecret()) |
|
||||
.queryParam("js_code", code) |
|
||||
.queryParam("grant_type", "authorization_code") |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
@Data |
|
||||
@SuppressWarnings("SpellCheckingInspection") |
|
||||
private static class JSCode2SessionResponse { |
|
||||
|
|
||||
@JsonProperty("errcode") |
|
||||
private int errorCode; |
|
||||
@JsonProperty("errmsg") |
|
||||
private String errorMsg; |
|
||||
@JsonProperty("session_key") |
|
||||
private String sessionKey; |
|
||||
private String openid; |
|
||||
@JsonProperty("unionid") |
|
||||
private String unionId; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,178 +0,0 @@ |
|||||
package com.win.framework.social.core.request; |
|
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import com.xingyuv.jushauth.cache.AuthStateCache; |
|
||||
import com.xingyuv.jushauth.config.AuthConfig; |
|
||||
import com.xingyuv.jushauth.config.AuthDefaultSource; |
|
||||
import com.xingyuv.jushauth.enums.AuthResponseStatus; |
|
||||
import com.xingyuv.jushauth.enums.AuthUserGender; |
|
||||
import com.xingyuv.jushauth.enums.scope.AuthWechatMpScope; |
|
||||
import com.xingyuv.jushauth.exception.AuthException; |
|
||||
import com.xingyuv.jushauth.model.AuthCallback; |
|
||||
import com.xingyuv.jushauth.model.AuthResponse; |
|
||||
import com.xingyuv.jushauth.model.AuthToken; |
|
||||
import com.xingyuv.jushauth.model.AuthUser; |
|
||||
import com.xingyuv.jushauth.request.AuthDefaultRequest; |
|
||||
import com.xingyuv.jushauth.utils.AuthScopeUtils; |
|
||||
import com.xingyuv.jushauth.utils.GlobalAuthUtils; |
|
||||
import com.xingyuv.jushauth.utils.HttpUtils; |
|
||||
import com.xingyuv.jushauth.utils.UrlBuilder; |
|
||||
|
|
||||
/** |
|
||||
* 微信公众平台登录 |
|
||||
* |
|
||||
* @author yangkai.shen (https://xkcoding.com)
|
|
||||
* @since 1.1.0 |
|
||||
*/ |
|
||||
public class AuthWeChatMpRequest extends AuthDefaultRequest { |
|
||||
public AuthWeChatMpRequest(AuthConfig config) { |
|
||||
super(config, AuthDefaultSource.WECHAT_MP); |
|
||||
} |
|
||||
|
|
||||
public AuthWeChatMpRequest(AuthConfig config, AuthStateCache authStateCache) { |
|
||||
super(config, AuthDefaultSource.WECHAT_MP, authStateCache); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 微信的特殊性,此时返回的信息同时包含 openid 和 access_token |
|
||||
* |
|
||||
* @param authCallback 回调返回的参数 |
|
||||
* @return 所有信息 |
|
||||
*/ |
|
||||
@Override |
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) { |
|
||||
return this.getToken(accessTokenUrl(authCallback.getCode())); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected AuthUser getUserInfo(AuthToken authToken) { |
|
||||
String openId = authToken.getOpenId(); |
|
||||
|
|
||||
String response = doGetUserInfo(authToken); |
|
||||
JSONObject object = JSONObject.parseObject(response); |
|
||||
|
|
||||
this.checkResponse(object); |
|
||||
|
|
||||
String location = String.format("%s-%s-%s", object.getString("country"), object.getString("province"), object.getString("city")); |
|
||||
|
|
||||
if (object.containsKey("unionid")) { |
|
||||
authToken.setUnionId(object.getString("unionid")); |
|
||||
} |
|
||||
|
|
||||
return AuthUser.builder() |
|
||||
.rawUserInfo(object) |
|
||||
.username(object.getString("nickname")) |
|
||||
.nickname(object.getString("nickname")) |
|
||||
.avatar(object.getString("headimgurl")) |
|
||||
.location(location) |
|
||||
.uuid(openId) |
|
||||
.gender(AuthUserGender.getWechatRealGender(object.getString("sex"))) |
|
||||
.token(authToken) |
|
||||
.source(source.toString()) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public AuthResponse refresh(AuthToken oldToken) { |
|
||||
return AuthResponse.builder() |
|
||||
.code(AuthResponseStatus.SUCCESS.getCode()) |
|
||||
.data(this.getToken(refreshTokenUrl(oldToken.getRefreshToken()))) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 检查响应内容是否正确 |
|
||||
* |
|
||||
* @param object 请求响应内容 |
|
||||
*/ |
|
||||
private void checkResponse(JSONObject object) { |
|
||||
if (object.containsKey("errcode")) { |
|
||||
throw new AuthException(object.getIntValue("errcode"), object.getString("errmsg")); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 获取token,适用于获取access_token和刷新token |
|
||||
* |
|
||||
* @param accessTokenUrl 实际请求token的地址 |
|
||||
* @return token对象 |
|
||||
*/ |
|
||||
private AuthToken getToken(String accessTokenUrl) { |
|
||||
String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl).getBody(); |
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response); |
|
||||
|
|
||||
this.checkResponse(accessTokenObject); |
|
||||
|
|
||||
return AuthToken.builder() |
|
||||
.accessToken(accessTokenObject.getString("access_token")) |
|
||||
.refreshToken(accessTokenObject.getString("refresh_token")) |
|
||||
.expireIn(accessTokenObject.getIntValue("expires_in")) |
|
||||
.openId(accessTokenObject.getString("openid")) |
|
||||
.scope(accessTokenObject.getString("scope")) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回带{@code state}参数的授权url,授权回调时会带上这个{@code state} |
|
||||
* |
|
||||
* @param state state 验证授权流程的参数,可以防止csrf |
|
||||
* @return 返回授权地址 |
|
||||
* @since 1.9.3 |
|
||||
*/ |
|
||||
@Override |
|
||||
public String authorize(String state) { |
|
||||
return UrlBuilder.fromBaseUrl(source.authorize()) |
|
||||
.queryParam("appid", config.getClientId()) |
|
||||
.queryParam("redirect_uri", GlobalAuthUtils.urlEncode(config.getRedirectUri())) |
|
||||
.queryParam("response_type", "code") |
|
||||
.queryParam("scope", this.getScopes(",", false, AuthScopeUtils.getDefaultScopes(AuthWechatMpScope.values()))) |
|
||||
.queryParam("state", getRealState(state).concat("#wechat_redirect")) |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回获取accessToken的url |
|
||||
* |
|
||||
* @param code 授权码 |
|
||||
* @return 返回获取accessToken的url |
|
||||
*/ |
|
||||
@Override |
|
||||
protected String accessTokenUrl(String code) { |
|
||||
return UrlBuilder.fromBaseUrl(source.accessToken()) |
|
||||
.queryParam("appid", config.getClientId()) |
|
||||
.queryParam("secret", config.getClientSecret()) |
|
||||
.queryParam("code", code) |
|
||||
.queryParam("grant_type", "authorization_code") |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回获取userInfo的url |
|
||||
* |
|
||||
* @param authToken 用户授权后的token |
|
||||
* @return 返回获取userInfo的url |
|
||||
*/ |
|
||||
@Override |
|
||||
protected String userInfoUrl(AuthToken authToken) { |
|
||||
return UrlBuilder.fromBaseUrl(source.userInfo()) |
|
||||
.queryParam("access_token", authToken.getAccessToken()) |
|
||||
.queryParam("openid", authToken.getOpenId()) |
|
||||
.queryParam("lang", "zh_CN") |
|
||||
.build(); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回获取userInfo的url |
|
||||
* |
|
||||
* @param refreshToken getAccessToken方法返回的refreshToken |
|
||||
* @return 返回获取userInfo的url |
|
||||
*/ |
|
||||
@Override |
|
||||
protected String refreshTokenUrl(String refreshToken) { |
|
||||
return UrlBuilder.fromBaseUrl(source.refresh()) |
|
||||
.queryParam("appid", config.getClientId()) |
|
||||
.queryParam("grant_type", "refresh_token") |
|
||||
.queryParam("refresh_token", refreshToken) |
|
||||
.build(); |
|
||||
} |
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
com.win.framework.social.config.WinSocialAutoConfiguration |
|
@ -1,45 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<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/xsd/maven-4.0.0.xsd"> |
|
||||
<parent> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-framework</artifactId> |
|
||||
<version>${revision}</version> |
|
||||
</parent> |
|
||||
<modelVersion>4.0.0</modelVersion> |
|
||||
<artifactId>win-spring-boot-starter-biz-weixin</artifactId> |
|
||||
<packaging>jar</packaging> |
|
||||
|
|
||||
<name>${project.artifactId}</name> |
|
||||
<description>微信拓展 |
|
||||
1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。 |
|
||||
2. 基于 weixin-java-miniapp 库,对接微信小程序。目前主要解决微信小程序的一键登录场景。 |
|
||||
</description> |
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url> |
|
||||
|
|
||||
<dependencies> |
|
||||
<dependency> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-common</artifactId> |
|
||||
</dependency> |
|
||||
|
|
||||
<!-- Test 测试相关 --> |
|
||||
<dependency> |
|
||||
<groupId>com.win</groupId> |
|
||||
<artifactId>win-spring-boot-starter-test</artifactId> |
|
||||
<scope>test</scope> |
|
||||
</dependency> |
|
||||
|
|
||||
<!-- 三方云服务相关 --> |
|
||||
<dependency> |
|
||||
<groupId>com.github.binarywang</groupId> |
|
||||
<artifactId>wx-java-mp-spring-boot-starter</artifactId> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>com.github.binarywang</groupId> |
|
||||
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId> |
|
||||
</dependency> |
|
||||
</dependencies> |
|
||||
|
|
||||
</project> |
|
@ -1,7 +0,0 @@ |
|||||
/** |
|
||||
* 微信拓展 |
|
||||
* 1. 基于 weixin-java-mp 库,对接微信公众号平台。目前主要解决微信公众号的支付场景。 |
|
||||
* 2. 基于 weixin-java-miniapp 库,对接微信小程序。目前主要解决微信小程序的一键登录场景。 |
|
||||
*/ |
|
||||
package com.win.framework.weixin; |
|
||||
|
|
@ -1 +0,0 @@ |
|||||
<https://www.iocoder.cn/Spring-Boot/Resilience4j/?win> |
|
@ -1 +0,0 @@ |
|||||
<http://www.iocoder.cn/Spring-Boot/MapStruct/?win> |
|
@ -1 +0,0 @@ |
|||||
<http://www.iocoder.cn/Spring-Boot/MapStruct/?win> |
|
@ -1 +0,0 @@ |
|||||
<http://www.iocoder.cn/Spring-Boot/Admin/?win> |
|
@ -1,34 +0,0 @@ |
|||||
package com.win.module.system.controller.admin.auth.vo; |
|
||||
|
|
||||
import com.win.framework.common.validation.InEnum; |
|
||||
import com.win.module.system.enums.social.SocialTypeEnum; |
|
||||
import io.swagger.v3.oas.annotations.media.Schema; |
|
||||
import lombok.AllArgsConstructor; |
|
||||
import lombok.Builder; |
|
||||
import lombok.Data; |
|
||||
import lombok.NoArgsConstructor; |
|
||||
|
|
||||
import javax.validation.constraints.NotEmpty; |
|
||||
import javax.validation.constraints.NotNull; |
|
||||
|
|
||||
@Schema(description = "管理后台 - 社交绑定登录 Request VO,使用 code 授权码 + 账号密码") |
|
||||
@Data |
|
||||
@NoArgsConstructor |
|
||||
@AllArgsConstructor |
|
||||
@Builder |
|
||||
public class AuthSocialLoginReqVO { |
|
||||
|
|
||||
@Schema(description = "社交平台的类型,参见 UserSocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
|
||||
@InEnum(SocialTypeEnum.class) |
|
||||
@NotNull(message = "社交平台的类型不能为空") |
|
||||
private Integer type; |
|
||||
|
|
||||
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
|
||||
@NotEmpty(message = "授权码不能为空") |
|
||||
private String code; |
|
||||
|
|
||||
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62") |
|
||||
@NotEmpty(message = "state 不能为空") |
|
||||
private String state; |
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue