mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	code review 社交登陆相关的代码
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
			
		||||
package cn.iocoder.yudao.framework.social.core;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.EnumUtil;
 | 
			
		||||
import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource;
 | 
			
		||||
import cn.iocoder.yudao.framework.social.core.request.AuthWeChatMiniProgramRequest;
 | 
			
		||||
import com.xkcoding.http.config.HttpConfig;
 | 
			
		||||
@@ -18,12 +17,14 @@ import java.net.Proxy;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 第三方授权拓展request工厂类
 | 
			
		||||
 * 第三方授权拓展 request 工厂类
 | 
			
		||||
 * TODO @timfruit 可以说明下,为啥有了 AuthRequestFactory 类,咱还需要自定义
 | 
			
		||||
 *
 | 
			
		||||
 * @author timfruit
 | 
			
		||||
 * @date 2021-10-31
 | 
			
		||||
 */
 | 
			
		||||
public class YudaoAuthRequestFactory extends AuthRequestFactory {
 | 
			
		||||
 | 
			
		||||
    protected JustAuthProperties properties;
 | 
			
		||||
    protected AuthStateCache authStateCache;
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +35,7 @@ public class YudaoAuthRequestFactory extends AuthRequestFactory {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回AuthRequest对象
 | 
			
		||||
     * 返回 AuthRequest 对象
 | 
			
		||||
     *
 | 
			
		||||
     * @param source {@link AuthSource}
 | 
			
		||||
     * @return {@link AuthRequest}
 | 
			
		||||
@@ -86,6 +87,7 @@ public class YudaoAuthRequestFactory extends AuthRequestFactory {
 | 
			
		||||
     * @param authConfig {@link AuthConfig}
 | 
			
		||||
     */
 | 
			
		||||
    protected void configureHttpConfig(String authSource, AuthConfig authConfig, JustAuthProperties.JustAuthHttpConfig httpConfig) {
 | 
			
		||||
        // TODO @timfruit:可以改成反射调用父类的方法。可能有一定的损耗,但是可以忽略不计的
 | 
			
		||||
        if (null == httpConfig) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.social.core.enums;
 | 
			
		||||
 | 
			
		||||
import me.zhyd.oauth.config.AuthSource;
 | 
			
		||||
 | 
			
		||||
// TODO @timfruit:类注释
 | 
			
		||||
public enum AuthExtendSource implements AuthSource {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -28,6 +29,4 @@ public enum AuthExtendSource implements AuthSource {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import lombok.*;
 | 
			
		||||
import me.zhyd.oauth.model.AuthToken;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 授权所需的token 拓展类
 | 
			
		||||
 * 授权所需的 token 拓展类
 | 
			
		||||
 *
 | 
			
		||||
 * @author timfruit
 | 
			
		||||
 * @date 2021-10-29
 | 
			
		||||
@@ -16,7 +16,7 @@ import me.zhyd.oauth.model.AuthToken;
 | 
			
		||||
public class AuthExtendToken extends AuthToken {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 微信小程序 会话密钥
 | 
			
		||||
     * 微信小程序 - 会话密钥
 | 
			
		||||
     */
 | 
			
		||||
    private String miniSessionKey;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -86,6 +86,7 @@ public class AuthWeChatMiniProgramRequest extends AuthDefaultRequest {
 | 
			
		||||
                .build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO @timfruit:我们要采用驼峰的命名方式。不匹配的,可以通过 jackson 的自定义注解映射
 | 
			
		||||
    @Data
 | 
			
		||||
    private static class CodeSessionResponse {
 | 
			
		||||
        private int errcode;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user