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
446c3293
Commit
446c3293
authored
Nov 20, 2019
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
e9e3cb73
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
12 deletions
+56
-12
DataConstant.java
...core/src/main/java/cn/datax/common/core/DataConstant.java
+55
-11
DataFeignRequestInterceptor.java
...ax/common/security/feign/DataFeignRequestInterceptor.java
+1
-1
No files found.
datax-common/datax-common-core/src/main/java/cn/datax/common/core/DataConstant.java
View file @
446c3293
...
...
@@ -7,25 +7,21 @@ public class DataConstant {
*/
public
enum
Security
{
//请求头TOKEN名称
TOKENHEADER
(
"
tokenHeader"
,
"
gatewayToken"
),
TOKENHEADER
(
"gatewayToken"
),
//请求头TOKEN值
TOKENVALUE
(
"tokenValue"
,
"datax:gateway:123456"
),
TOKENVALUE
(
"datax:gateway:123456"
),
//OAUTH2请求头
AUTHORIZATION
(
"Authorization"
),
//OAUTH2令牌类型
TOKENTYPE
(
"
tokenType"
,
"
bearer "
),
TOKENTYPE
(
"bearer "
),
//security授权角色前缀
ROLEPREFIX
(
"rolePrefix"
,
"ROLE_"
);
Security
(
String
key
,
String
val
){
this
.
key
=
key
;
ROLEPREFIX
(
"ROLE_"
);
Security
(
String
val
){
this
.
val
=
val
;
}
private
final
String
key
;
private
final
String
val
;
public
String
getKey
()
{
return
key
;
}
public
String
getVal
()
{
return
val
;
}
...
...
@@ -105,4 +101,52 @@ public class DataConstant {
return
val
;
}
}
/**
* 流程审核状态
*/
public
enum
AuditState
{
WAIT
(
1
,
"待审核"
),
AUDIT
(
2
,
"审核中"
),
PASS
(
3
,
"审核通过"
),
NOTPASS
(
4
,
"审核不通过"
);
AuditState
(
Integer
key
,
String
val
){
this
.
key
=
key
;
this
.
val
=
val
;
}
private
final
Integer
key
;
private
final
String
val
;
public
Integer
getKey
()
{
return
key
;
}
public
String
getVal
()
{
return
val
;
}
}
/**
* 流程审批状态
*/
public
enum
ApproveState
{
REJECT
(
0
,
"不通过"
),
PASS
(
1
,
"通过"
);
ApproveState
(
Integer
key
,
String
val
){
this
.
key
=
key
;
this
.
val
=
val
;
}
private
final
Integer
key
;
private
final
String
val
;
public
Integer
getKey
()
{
return
key
;
}
public
String
getVal
()
{
return
val
;
}
}
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/feign/DataFeignRequestInterceptor.java
View file @
446c3293
...
...
@@ -22,7 +22,7 @@ public class DataFeignRequestInterceptor {
Object
details
=
SecurityContextHolder
.
getContext
().
getAuthentication
().
getDetails
();
if
(
details
instanceof
OAuth2AuthenticationDetails
)
{
String
authorizationToken
=
((
OAuth2AuthenticationDetails
)
details
).
getTokenValue
();
requestTemplate
.
header
(
HttpHeaders
.
AUTHORIZATION
,
DataConstant
.
Security
.
TOKENTYPE
.
getVal
()
+
authorizationToken
);
requestTemplate
.
header
(
DataConstant
.
Security
.
AUTHORIZATION
.
getVal
()
,
DataConstant
.
Security
.
TOKENTYPE
.
getVal
()
+
authorizationToken
);
}
};
}
...
...
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