Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
ac689ac7
Unverified
Commit
ac689ac7
authored
Feb 27, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
动态切换登录授权接口地址
parent
cce83b6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
src/main/java/org/b3log/solo/model/Common.java
src/main/java/org/b3log/solo/model/Common.java
+6
-1
src/main/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
...n/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
+3
-2
No files found.
src/main/java/org/b3log/solo/model/Common.java
View file @
ac689ac7
...
@@ -22,11 +22,16 @@ package org.b3log.solo.model;
...
@@ -22,11 +22,16 @@ package org.b3log.solo.model;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/e">Dongxu Wang</a>
* @author <a href="https://hacpai.com/member/e">Dongxu Wang</a>
* @version 1.7.0.
2, Feb 11
, 2019
* @version 1.7.0.
3, Feb 27
, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Common
{
public
final
class
Common
{
/**
* Key of URL.
*/
public
static
final
String
URL
=
"url"
;
/**
/**
* Key of referer.
* Key of referer.
*/
*/
...
...
src/main/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
View file @
ac689ac7
...
@@ -55,7 +55,7 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -55,7 +55,7 @@ import java.util.concurrent.ConcurrentHashMap;
* </ul>
* </ul>
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
4, Feb 15
, 2019
* @version 1.0.0.
5, Feb 27
, 2019
* @since 2.9.5
* @since 2.9.5
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -137,6 +137,7 @@ public class OAuthGitHubProcessor {
...
@@ -137,6 +137,7 @@ public class OAuthGitHubProcessor {
return
;
return
;
}
}
final
String
clientId
=
result
.
optString
(
Common
.
DATA
);
final
String
clientId
=
result
.
optString
(
Common
.
DATA
);
final
String
loginAuthURL
=
result
.
optString
(
Common
.
URL
);
String
referer
=
context
.
param
(
"referer"
);
String
referer
=
context
.
param
(
"referer"
);
if
(
StringUtils
.
isBlank
(
referer
))
{
if
(
StringUtils
.
isBlank
(
referer
))
{
...
@@ -146,7 +147,7 @@ public class OAuthGitHubProcessor {
...
@@ -146,7 +147,7 @@ public class OAuthGitHubProcessor {
final
String
state
=
referer
+
":::"
+
RandomStringUtils
.
randomAlphanumeric
(
16
)
+
":::cb="
+
cb
+
":::"
;
final
String
state
=
referer
+
":::"
+
RandomStringUtils
.
randomAlphanumeric
(
16
)
+
":::cb="
+
cb
+
":::"
;
STATES
.
put
(
state
,
URLs
.
encode
(
state
));
STATES
.
put
(
state
,
URLs
.
encode
(
state
));
final
String
path
=
"https://github.com/login/oauth/authorize"
+
"?client_id="
+
clientId
+
"&state="
+
state
final
String
path
=
loginAuthURL
+
"?client_id="
+
clientId
+
"&state="
+
state
+
"&scope=public_repo,read:user,user:email,user:follow"
;
+
"&scope=public_repo,read:user,user:email,user:follow"
;
context
.
sendRedirect
(
path
);
context
.
sendRedirect
(
path
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment