Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
逝缘~
JustAuth
提交
89fc9903
J
JustAuth
项目概览
逝缘~
/
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,发现更多精彩内容 >>
提交
89fc9903
编写于
3月 22, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💩
去掉非强制的依赖项
上级
04400f55
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
4 addition
and
47 deletion
+4
-47
pom.xml
pom.xml
+0
-6
src/main/java/me/zhyd/oauth/request/AuthRequest.java
src/main/java/me/zhyd/oauth/request/AuthRequest.java
+0
-12
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
+0
-2
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
+0
-8
src/main/java/me/zhyd/oauth/utils/IpUtils.java
src/main/java/me/zhyd/oauth/utils/IpUtils.java
+0
-3
src/test/java/me/zhyd/oauth/AuthRequestTest.java
src/test/java/me/zhyd/oauth/AuthRequestTest.java
+4
-16
未找到文件。
pom.xml
浏览文件 @
89fc9903
...
...
@@ -43,7 +43,6 @@
<hutool-version>
4.1.21
</hutool-version>
<lombok-version>
1.18.4
</lombok-version>
<junit-version>
4.11
</junit-version>
<servlet-api-version>
2.5
</servlet-api-version>
<fastjson-version>
1.2.44
</fastjson-version>
<google-api-version>
1.28.0
</google-api-version>
</properties>
...
...
@@ -65,11 +64,6 @@
<version>
${junit-version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<version>
${servlet-api-version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
...
...
src/main/java/me/zhyd/oauth/request/AuthRequest.java
浏览文件 @
89fc9903
...
...
@@ -3,9 +3,6 @@ package me.zhyd.oauth.request;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.AuthResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
...
...
@@ -15,15 +12,6 @@ import java.io.IOException;
*/
public
interface
AuthRequest
{
/**
* 自动跳转到认证页面
*
* @param response response
*/
default
void
authorize
(
HttpServletResponse
response
)
throws
IOException
{
throw
new
AuthException
(
ResponseStatus
.
NOT_IMPLEMENTED
);
}
/**
* 返回认证url,可自行跳转页面
*/
...
...
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
浏览文件 @
89fc9903
...
...
@@ -13,8 +13,6 @@ import me.zhyd.oauth.utils.IpUtils;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
...
...
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
浏览文件 @
89fc9903
...
...
@@ -9,9 +9,6 @@ import me.zhyd.oauth.model.AuthUser;
import
me.zhyd.oauth.utils.AuthConfigChecker
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
...
...
@@ -43,11 +40,6 @@ public abstract class BaseAuthRequest implements AuthRequest {
.
build
();
}
@Override
public
void
authorize
(
HttpServletResponse
response
)
throws
IOException
{
response
.
sendRedirect
(
this
.
authorize
());
}
@Override
public
String
authorize
()
{
String
authorizeUrl
=
null
;
...
...
src/main/java/me/zhyd/oauth/utils/IpUtils.java
浏览文件 @
89fc9903
package
me.zhyd.oauth.utils
;
import
lombok.extern.slf4j.Slf4j
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
...
...
src/test/java/me/zhyd/oauth/AuthRequestTest.java
浏览文件 @
89fc9903
...
...
@@ -4,7 +4,7 @@ import me.zhyd.oauth.config.AuthConfig;
import
me.zhyd.oauth.request.*
;
import
org.junit.Test
;
import
java
x.servlet.http.HttpServletResponse
;
import
java
.io.IOException
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
...
...
@@ -16,15 +16,12 @@ import javax.servlet.http.HttpServletResponse;
public
class
AuthRequestTest
{
@Test
public
void
giteeTest
()
{
HttpServletResponse
response
=
null
;
public
void
giteeTest
()
throws
IOException
{
AuthRequest
authRequest
=
new
AuthGiteeRequest
(
AuthConfig
.
builder
()
.
clientId
(
"clientId"
)
.
clientSecret
(
"clientSecret"
)
.
redirectUri
(
"redirectUri"
)
.
build
());
// 自动跳转到授权页面
authRequest
.
authorize
(
response
);
// 返回授权页面,可自行调整
authRequest
.
authorize
();
// 授权登录后会返回一个code,用这个code进行登录
...
...
@@ -32,15 +29,12 @@ public class AuthRequestTest {
}
@Test
public
void
githubTest
()
{
HttpServletResponse
response
=
null
;
public
void
githubTest
()
throws
IOException
{
AuthRequest
authRequest
=
new
AuthGithubRequest
(
AuthConfig
.
builder
()
.
clientId
(
"clientId"
)
.
clientSecret
(
"clientSecret"
)
.
redirectUri
(
"redirectUri"
)
.
build
());
// 自动跳转到授权页面
authRequest
.
authorize
(
response
);
// 返回授权页面,可自行调整
authRequest
.
authorize
();
// 授权登录后会返回一个code,用这个code进行登录
...
...
@@ -48,15 +42,12 @@ public class AuthRequestTest {
}
@Test
public
void
weiboTest
()
{
HttpServletResponse
response
=
null
;
public
void
weiboTest
()
throws
IOException
{
AuthRequest
authRequest
=
new
AuthWeiboRequest
(
AuthConfig
.
builder
()
.
clientId
(
"clientId"
)
.
clientSecret
(
"clientSecret"
)
.
redirectUri
(
"redirectUri"
)
.
build
());
// 自动跳转到授权页面
authRequest
.
authorize
(
response
);
// 返回授权页面,可自行调整
authRequest
.
authorize
();
// 授权登录后会返回一个code,用这个code进行登录
...
...
@@ -65,14 +56,11 @@ public class AuthRequestTest {
@Test
public
void
dingdingTest
()
{
HttpServletResponse
response
=
null
;
AuthRequest
authRequest
=
new
AuthDingTalkRequest
(
AuthConfig
.
builder
()
.
clientId
(
"dingoa2q6o3fomfk6vdqzy"
)
.
clientSecret
(
"d5w75-R-yNtQsq_Ya_r50gOsKOy9WlmrlUOJkUJXKvsQp7NDPRHsj0epJriiN3yO"
)
.
redirectUri
(
"http://61.149.7.121:8443/oauth/dingtalk/callback"
)
.
build
());
// 自动跳转到授权页面
// authRequest.authorize(response);
// 返回授权页面,可自行调整
String
url
=
authRequest
.
authorize
();
System
.
out
.
println
(
url
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录