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
a387036b
Commit
a387036b
authored
Nov 06, 2019
by
yw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
f173a2a5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
47 deletions
+73
-47
DataxAuthApplication.java
...uth/src/main/java/cn/datax/auth/DataxAuthApplication.java
+4
-8
DataInner.java
...n/java/cn/datax/common/security/annotation/DataInner.java
+18
-0
EnableDataSecurity.java
.../datax/common/security/annotation/EnableDataSecurity.java
+5
-3
DataOAuth2FeignConfiguration.java
.../common/security/config/DataOAuth2FeignConfiguration.java
+0
-6
DataSecurityApplicationSelector.java
...mmon/security/config/DataSecurityApplicationSelector.java
+0
-16
DataSecurityInnerAspect.java
...datax/common/security/config/DataSecurityInnerAspect.java
+25
-0
DataFeignRequestInterceptor.java
...ax/common/security/feign/DataFeignRequestInterceptor.java
+2
-0
EmailEntity.java
...n/java/cn/datax/service/email/api/entity/EmailEntity.java
+4
-0
FileController.java
...java/cn/datax/service/file/controller/FileController.java
+1
-1
DataxSystemApplication.java
.../java/cn/datax/service/system/DataxSystemApplication.java
+5
-11
ResourceServerConfig.java
.../cn/datax/service/system/config/ResourceServerConfig.java
+2
-1
UserController.java
...va/cn/datax/service/system/controller/UserController.java
+5
-1
pom.xml
pom.xml
+2
-0
No files found.
datax-auth/src/main/java/cn/datax/auth/DataxAuthApplication.java
View file @
a387036b
...
...
@@ -5,21 +5,17 @@ import cn.datax.common.redis.annotation.EnableDataRedis;
import
cn.datax.common.security.annotation.EnableDataAuthExceptionHandler
;
import
cn.datax.common.security.annotation.EnableDataServerProtect
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableDataAuthExceptionHandler
@EnableDataServerProtect
@EnableDataMybatis
@EnableDataRedis
@EnableFeignClients
@ComponentScan
({
"cn.datax"
})
@Spring
Boot
Application
@EnableFeignClients
(
basePackages
=
{
"cn.datax.service.system.api.feign"
})
@ComponentScan
(
basePackages
=
{
"cn.datax"
})
@Spring
Cloud
Application
public
class
DataxAuthApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
datax-common/datax-common-security/src/main/java/cn/datax/common/security/annotation/DataInner.java
0 → 100644
View file @
a387036b
package
cn
.
datax
.
common
.
security
.
annotation
;
import
java.lang.annotation.*
;
/**
* 服务调用不鉴权注解
*/
@Target
({
ElementType
.
PARAMETER
,
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
DataInner
{
/**
* 是否AOP统一处理
*
* @return false, true
*/
boolean
value
()
default
true
;
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/annotation/EnableDataSecurity
Application
.java
→
datax-common/datax-common-security/src/main/java/cn/datax/common/security/annotation/EnableDataSecurity.java
View file @
a387036b
package
cn
.
datax
.
common
.
security
.
annotation
;
import
cn.datax.common.security.config.DataSecurityApplicationSelector
;
import
cn.datax.common.security.config.DataAuthExceptionConfiguration
;
import
cn.datax.common.security.config.DataOAuth2FeignConfiguration
;
import
cn.datax.common.security.config.DataServerProtectConfiguration
;
import
org.springframework.context.annotation.Import
;
import
java.lang.annotation.*
;
...
...
@@ -9,6 +11,6 @@ import java.lang.annotation.*;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Inherited
@Import
({
Data
SecurityApplicationSelector
.
class
})
public
@interface
EnableDataSecurity
Application
{
@Import
({
Data
AuthExceptionConfiguration
.
class
,
DataOAuth2FeignConfiguration
.
class
,
DataServerProtectConfiguration
.
class
})
public
@interface
EnableDataSecurity
{
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/config/DataOAuth2FeignConfiguration.java
View file @
a387036b
package
cn
.
datax
.
common
.
security
.
config
;
import
cn.datax.common.security.feign.DataFeignRequestInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
/**
...
...
@@ -12,8 +10,4 @@ import org.springframework.context.annotation.ComponentScan;
@ComponentScan
({
"cn.datax.common.security.feign"
})
public
class
DataOAuth2FeignConfiguration
{
@Bean
public
DataFeignRequestInterceptor
dataFeignRequestInterceptor
()
{
return
new
DataFeignRequestInterceptor
();
}
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/config/DataSecurityApplicationSelector.java
deleted
100644 → 0
View file @
f173a2a5
package
cn
.
datax
.
common
.
security
.
config
;
import
org.springframework.context.annotation.ImportSelector
;
import
org.springframework.core.type.AnnotationMetadata
;
public
class
DataSecurityApplicationSelector
implements
ImportSelector
{
@Override
public
String
[]
selectImports
(
AnnotationMetadata
annotationMetadata
)
{
return
new
String
[]{
DataAuthExceptionConfiguration
.
class
.
getName
(),
DataOAuth2FeignConfiguration
.
class
.
getName
(),
DataServerProtectConfiguration
.
class
.
getName
()
};
}
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/config/DataSecurityInnerAspect.java
0 → 100644
View file @
a387036b
package
cn
.
datax
.
common
.
security
.
config
;
import
cn.datax.common.security.annotation.DataInner
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.springframework.stereotype.Component
;
/**
* 服务间接口不鉴权处理逻辑
*/
@Slf4j
@Aspect
@Component
public
class
DataSecurityInnerAspect
{
@SneakyThrows
@Around
(
"@annotation(dataInner)"
)
public
Object
around
(
ProceedingJoinPoint
point
,
DataInner
dataInner
)
{
log
.
info
(
"feign内部接口访问 {} 不鉴权处理"
,
point
.
getSignature
().
getName
());
return
point
.
proceed
();
}
}
datax-common/datax-common-security/src/main/java/cn/datax/common/security/feign/DataFeignRequestInterceptor.java
View file @
a387036b
...
...
@@ -4,10 +4,12 @@ import cn.datax.common.core.DataConstant;
import
com.google.common.net.HttpHeaders
;
import
feign.RequestInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails
;
import
org.springframework.util.Base64Utils
;
@Configuration
public
class
DataFeignRequestInterceptor
{
@Bean
...
...
datax-modules/email-service-parent/email-service-api/src/main/java/cn/datax/service/email/api/entity/EmailEntity.java
View file @
a387036b
...
...
@@ -2,11 +2,15 @@ package cn.datax.service.email.api.entity;
import
cn.datax.common.base.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.File
;
import
java.util.List
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
public
class
EmailEntity
extends
BaseEntity
{
/**
...
...
datax-modules/file-service-parent/file-service/src/main/java/cn/datax/service/file/controller/FileController.java
View file @
a387036b
...
...
@@ -36,7 +36,7 @@ public class FileController extends BaseController {
@GetMapping
(
"/page"
)
public
R
getFilePage
(
Page
page
,
FileEntity
file
)
{
return
R
.
ok
().
setData
(
fileService
.
page
(
page
,
null
));
return
R
.
ok
().
setData
(
fileService
.
page
(
page
,
Wrappers
.
query
(
file
)
));
}
@PostMapping
(
"/upload"
)
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/DataxSystemApplication.java
View file @
a387036b
...
...
@@ -3,25 +3,19 @@ package cn.datax.service.system;
import
cn.datax.common.log.annotation.EnableDataLog
;
import
cn.datax.common.mybatis.annotation.EnableDataMybatis
;
import
cn.datax.common.redis.annotation.EnableDataRedis
;
import
cn.datax.common.security.annotation.EnableDataAuthExceptionHandler
;
import
cn.datax.common.security.annotation.EnableDataServerProtect
;
import
cn.datax.common.security.annotation.EnableDataSecurity
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
@EnableDataAuthExceptionHandler
@EnableDataServerProtect
@EnableDataSecurity
@EnableDataMybatis
@EnableDataRedis
@EnableDataLog
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableFeignClients
@ComponentScan
({
"cn.datax"
})
@Spring
Boot
Application
@ComponentScan
(
basePackages
=
{
"cn.datax"
})
@Spring
Cloud
Application
public
class
DataxSystemApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/config/ResourceServerConfig.java
View file @
a387036b
...
...
@@ -57,7 +57,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
"/swagger-ui.html"
,
"/doc.html"
,
"/swagger-resources/**"
,
"/webjars/**"
).
permitAll
()
"/webjars/**"
,
"/users/username/**"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
and
().
csrf
().
disable
();
}
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/UserController.java
View file @
a387036b
package
cn
.
datax
.
service
.
system
.
controller
;
import
cn.datax.common.core.R
;
import
cn.datax.common.security.annotation.DataInner
;
import
cn.datax.common.validate.ValidateGroupForSave
;
import
cn.datax.common.validate.ValidateGroupForUpdate
;
import
cn.datax.service.system.api.dto.UserDto
;
...
...
@@ -17,6 +18,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,6 +33,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-04
*/
@Slf4j
@Api
(
value
=
"系统管理接口"
,
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/users"
)
...
...
@@ -50,13 +53,14 @@ public class UserController extends BaseController {
return
R
.
ok
().
setData
(
userMapper
.
toVO
(
userEntity
));
}
@DataInner
@ApiOperation
(
value
=
"获取用户详细信息"
,
notes
=
"根据url的username来获取用户详细信息"
)
@ApiImplicitParam
(
name
=
"username"
,
value
=
"用户名"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/username/{username}"
)
public
R
getUserByUsername
(
@PathVariable
String
username
)
{
UserEntity
userEntity
=
userService
.
getOne
(
Wrappers
.<
UserEntity
>
query
()
.
lambda
().
eq
(
UserEntity:
:
getUsername
,
username
));
return
R
.
ok
().
setData
(
user
Entity
);
return
R
.
ok
().
setData
(
user
Mapper
.
toVO
(
userEntity
)
);
}
@ApiOperation
(
value
=
"用户分页查询"
,
notes
=
""
)
...
...
pom.xml
View file @
a387036b
...
...
@@ -144,6 +144,7 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<configuration>
<target>
${maven.compiler.target}
</target>
<source>
${maven.compiler.source}
</source>
...
...
@@ -153,6 +154,7 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
3.0.0-M3
</version>
<configuration>
<skipTests>
true
</skipTests>
</configuration>
...
...
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