Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Yanxianyang
JustAuth
提交
4c1fdfc6
J
JustAuth
项目概览
Yanxianyang
/
JustAuth
与 Fork 源项目一致
Fork自
justauth / JustAuth
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
JustAuth
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4c1fdfc6
编写于
7月 16, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🔀
手动合并PR #18 到dev分支
上级
dc74501b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
1 deletion
+10
-1
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
+4
-0
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
+5
-0
src/main/java/me/zhyd/oauth/url/AuthMiUrlBuilder.java
src/main/java/me/zhyd/oauth/url/AuthMiUrlBuilder.java
+1
-1
未找到文件。
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
浏览文件 @
4c1fdfc6
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
...
@@ -20,6 +21,7 @@ import java.text.MessageFormat;
...
@@ -20,6 +21,7 @@ import java.text.MessageFormat;
* @version 1.5
* @version 1.5
* @since 1.5
* @since 1.5
*/
*/
@Slf4j
public
class
AuthMiRequest
extends
AuthDefaultRequest
{
public
class
AuthMiRequest
extends
AuthDefaultRequest
{
private
static
final
String
PREFIX
=
"&&&START&&&"
;
private
static
final
String
PREFIX
=
"&&&START&&&"
;
...
@@ -90,6 +92,8 @@ public class AuthMiRequest extends AuthDefaultRequest {
...
@@ -90,6 +92,8 @@ public class AuthMiRequest extends AuthDefaultRequest {
if
(!
"error"
.
equalsIgnoreCase
(
userEmailPhone
.
getString
(
"result"
)))
{
if
(!
"error"
.
equalsIgnoreCase
(
userEmailPhone
.
getString
(
"result"
)))
{
JSONObject
emailPhone
=
userEmailPhone
.
getJSONObject
(
"data"
);
JSONObject
emailPhone
=
userEmailPhone
.
getJSONObject
(
"data"
);
authUser
.
setEmail
(
emailPhone
.
getString
(
"email"
));
authUser
.
setEmail
(
emailPhone
.
getString
(
"email"
));
}
else
{
log
.
warn
(
"小米开发平台暂时不对外开放用户手机及邮箱信息的获取"
);
}
}
return
authUser
;
return
authUser
;
...
...
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
浏览文件 @
4c1fdfc6
...
@@ -48,6 +48,11 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
...
@@ -48,6 +48,11 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
this
.
checkResponse
(
object
);
this
.
checkResponse
(
object
);
String
location
=
String
.
format
(
"%s-%s-%s"
,
object
.
getString
(
"country"
),
object
.
getString
(
"province"
),
object
.
getString
(
"city"
));
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
()
return
AuthUser
.
builder
()
.
username
(
object
.
getString
(
"nickname"
))
.
username
(
object
.
getString
(
"nickname"
))
.
nickname
(
object
.
getString
(
"nickname"
))
.
nickname
(
object
.
getString
(
"nickname"
))
...
...
src/main/java/me/zhyd/oauth/url/AuthMiUrlBuilder.java
浏览文件 @
4c1fdfc6
...
@@ -16,7 +16,7 @@ import java.text.MessageFormat;
...
@@ -16,7 +16,7 @@ import java.text.MessageFormat;
*/
*/
public
class
AuthMiUrlBuilder
extends
AuthDefaultUrlBuilder
{
public
class
AuthMiUrlBuilder
extends
AuthDefaultUrlBuilder
{
private
static
final
String
MI_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=
1%203%204%206
&state={3}&skip_confirm=false"
;
private
static
final
String
MI_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=
user/profile%20user/openIdV2%20user/phoneAndEmail
&state={3}&skip_confirm=false"
;
private
static
final
String
MI_ACCESS_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code"
;
private
static
final
String
MI_ACCESS_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code"
;
private
static
final
String
MI_USER_INFO_PATTERN
=
"{0}?clientId={1}&token={2}"
;
private
static
final
String
MI_USER_INFO_PATTERN
=
"{0}?clientId={1}&token={2}"
;
private
static
final
String
MI_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"
;
private
static
final
String
MI_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录