Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
黄营
datax-cloud
Commits
1f7c5dc9
Commit
1f7c5dc9
authored
May 15, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.0项目初始化
parent
f1857ffe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
9 deletions
+6
-9
DataOauthException.java
...ain/java/cn/datax/auth/translator/DataOauthException.java
+0
-4
DataOauthExceptionSerializer.java
...n/datax/auth/translator/DataOauthExceptionSerializer.java
+2
-1
DataWebResponseExceptionTranslator.java
...x/auth/translator/DataWebResponseExceptionTranslator.java
+1
-2
DataAccessDeniedHandler.java
...atax/common/security/handler/DataAccessDeniedHandler.java
+1
-1
DataAuthExceptionEntryPoint.java
.../common/security/handler/DataAuthExceptionEntryPoint.java
+1
-1
LoginController.java
...a/cn/datax/service/system/controller/LoginController.java
+1
-0
No files found.
datax-auth/src/main/java/cn/datax/auth/translator/DataOauthException.java
View file @
1f7c5dc9
...
...
@@ -9,8 +9,4 @@ public class DataOauthException extends OAuth2Exception {
public
DataOauthException
(
String
msg
)
{
super
(
msg
);
}
public
DataOauthException
(
String
msg
,
Throwable
t
)
{
super
(
msg
,
t
);
}
}
datax-auth/src/main/java/cn/datax/auth/translator/DataOauthExceptionSerializer.java
View file @
1f7c5dc9
...
...
@@ -3,6 +3,7 @@ package cn.datax.auth.translator;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.std.StdSerializer
;
import
org.springframework.http.HttpStatus
;
import
java.io.IOException
;
...
...
@@ -15,7 +16,7 @@ public class DataOauthExceptionSerializer extends StdSerializer<DataOauthExcepti
@Override
public
void
serialize
(
DataOauthException
value
,
JsonGenerator
gen
,
SerializerProvider
provider
)
throws
IOException
{
gen
.
writeStartObject
();
gen
.
writeNumberField
(
"code"
,
value
.
getHttpErrorCod
e
());
gen
.
writeNumberField
(
"code"
,
HttpStatus
.
INTERNAL_SERVER_ERROR
.
valu
e
());
gen
.
writeStringField
(
"msg"
,
value
.
getMessage
());
gen
.
writeBooleanField
(
"success"
,
false
);
gen
.
writeNumberField
(
"timestamp"
,
System
.
currentTimeMillis
());
...
...
datax-auth/src/main/java/cn/datax/auth/translator/DataWebResponseExceptionTranslator.java
View file @
1f7c5dc9
...
...
@@ -60,7 +60,6 @@ public class DataWebResponseExceptionTranslator implements WebResponseExceptionT
}
private
ResponseEntity
<
OAuth2Exception
>
handleOAuth2Exception
(
OAuth2Exception
e
)
{
int
status
=
e
.
getHttpErrorCode
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
HttpHeaders
.
CACHE_CONTROL
,
"no-store"
);
...
...
@@ -87,7 +86,7 @@ public class DataWebResponseExceptionTranslator implements WebResponseExceptionT
message
=
"用户名或密码错误"
;
}
}
return
new
ResponseEntity
<
OAuth2Exception
>(
new
DataOauthException
(
message
,
e
),
headers
,
HttpStatus
.
valueOf
(
status
));
return
new
ResponseEntity
<
OAuth2Exception
>(
new
DataOauthException
(
message
),
headers
,
HttpStatus
.
valueOf
(
status
));
}
public
void
setThrowableAnalyzer
(
ThrowableAnalyzer
throwableAnalyzer
)
{
...
...
datax-common/datax-common-security/src/main/java/cn/datax/common/security/handler/DataAccessDeniedHandler.java
View file @
1f7c5dc9
...
...
@@ -16,6 +16,6 @@ public class DataAccessDeniedHandler implements AccessDeniedHandler {
public
void
handle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AccessDeniedException
accessDeniedException
)
throws
IOException
{
ResponseUtil
.
makeResponse
(
response
,
MediaType
.
APPLICATION_JSON_VALUE
,
HttpServletResponse
.
SC_FORBIDDEN
,
R
.
error
(
"没有权限访问该资源"
));
HttpServletResponse
.
SC_FORBIDDEN
,
R
.
error
(
403
,
"没有权限访问该资源"
));
}
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/handler/DataAuthExceptionEntryPoint.java
View file @
1f7c5dc9
...
...
@@ -16,6 +16,6 @@ public class DataAuthExceptionEntryPoint implements AuthenticationEntryPoint {
public
void
commence
(
HttpServletRequest
request
,
HttpServletResponse
response
,
AuthenticationException
authException
)
throws
IOException
{
ResponseUtil
.
makeResponse
(
response
,
MediaType
.
APPLICATION_JSON_VALUE
,
HttpServletResponse
.
SC_UNAUTHORIZED
,
R
.
error
(
"无效的Token"
));
HttpServletResponse
.
SC_UNAUTHORIZED
,
R
.
error
(
401
,
"无效的Token"
));
}
}
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/LoginController.java
View file @
1f7c5dc9
...
...
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.oauth2.common.OAuth2AccessToken
;
import
org.springframework.security.oauth2.common.OAuth2RefreshToken
;
import
org.springframework.security.oauth2.provider.token.TokenStore
;
...
...
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