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
7bfb14ef
Unverified
Commit
7bfb14ef
authored
Feb 28, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
Cleanup code
parent
c0330205
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
+5
-11
No files found.
src/main/java/org/b3log/solo/processor/OAuthProcessor.java
View file @
7bfb14ef
...
@@ -107,18 +107,12 @@ public class OAuthProcessor {
...
@@ -107,18 +107,12 @@ public class OAuthProcessor {
private
InitService
initService
;
private
InitService
initService
;
/**
/**
* GitHub split.
* Redirects to auth page.
*/
public
static
final
String
GITHUB_SPLIT
=
":@:"
;
/**
* Redirects to GitHub auth page.
*
*
* @param context the specified context
* @param context the specified context
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/oauth/github/redirect"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/oauth/github/redirect"
,
method
=
HttpMethod
.
GET
)
public
void
redirect
GitHub
(
final
RequestContext
context
)
{
public
void
redirect
Auth
(
final
RequestContext
context
)
{
final
HttpResponse
res
=
HttpRequest
.
get
(
"https://hacpai.com/oauth/solo/client2"
).
trustAllCerts
(
true
).
final
HttpResponse
res
=
HttpRequest
.
get
(
"https://hacpai.com/oauth/solo/client2"
).
trustAllCerts
(
true
).
connectionTimeout
(
3000
).
timeout
(
7000
).
header
(
"User-Agent"
,
Solos
.
USER_AGENT
).
send
();
connectionTimeout
(
3000
).
timeout
(
7000
).
header
(
"User-Agent"
,
Solos
.
USER_AGENT
).
send
();
if
(
HttpServletResponse
.
SC_OK
!=
res
.
statusCode
())
{
if
(
HttpServletResponse
.
SC_OK
!=
res
.
statusCode
())
{
...
@@ -154,12 +148,12 @@ public class OAuthProcessor {
...
@@ -154,12 +148,12 @@ public class OAuthProcessor {
}
}
/**
/**
* Shows
GitHub
callback page.
* Shows
OAuth
callback page.
*
*
* @param context the specified context
* @param context the specified context
*/
*/
@RequestProcessing
(
value
=
"/oauth/github"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/oauth/github"
,
method
=
HttpMethod
.
GET
)
public
synchronized
void
show
GitHub
Callback
(
final
RequestContext
context
)
{
public
synchronized
void
show
Auth
Callback
(
final
RequestContext
context
)
{
final
String
state
=
context
.
param
(
"state"
);
final
String
state
=
context
.
param
(
"state"
);
String
referer
=
STATES
.
get
(
state
);
String
referer
=
STATES
.
get
(
state
);
if
(
StringUtils
.
isBlank
(
referer
))
{
if
(
StringUtils
.
isBlank
(
referer
))
{
...
@@ -237,6 +231,6 @@ public class OAuthProcessor {
...
@@ -237,6 +231,6 @@ public class OAuthProcessor {
final
String
redirect
=
StringUtils
.
substringBeforeLast
(
referer
,
"__"
);
final
String
redirect
=
StringUtils
.
substringBeforeLast
(
referer
,
"__"
);
Solos
.
login
(
user
,
response
);
Solos
.
login
(
user
,
response
);
context
.
sendRedirect
(
redirect
);
context
.
sendRedirect
(
redirect
);
LOGGER
.
log
(
Level
.
INFO
,
"Logged in [name={0}, remoteAddr={1}] with
GitHub
oauth"
,
userName
,
Requests
.
getRemoteAddr
(
request
));
LOGGER
.
log
(
Level
.
INFO
,
"Logged in [name={0}, remoteAddr={1}] with oauth"
,
userName
,
Requests
.
getRemoteAddr
(
request
));
}
}
}
}
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