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
09114c91
Commit
09114c91
authored
Nov 29, 2019
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
e1a5ddf7
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
509 additions
and
0 deletions
+509
-0
pom.xml
...-modules/flowable-service-parent/flowable-modeler/pom.xml
+86
-0
DataxFlowableModelerApplication.java
...ice/flowable/modeler/DataxFlowableModelerApplication.java
+21
-0
RemoteAccountResource.java
...able/ui/common/rest/idm/remote/RemoteAccountResource.java
+67
-0
SecurityUtils.java
...n/java/org/flowable/ui/common/security/SecurityUtils.java
+99
-0
SecurityConfiguration.java
...a/org/flowable/ui/modeler/conf/SecurityConfiguration.java
+169
-0
application.yml
...arent/flowable-modeler/src/main/resources/application.yml
+34
-0
pom.xml
datax-modules/flowable-service-parent/pom.xml
+20
-0
pom.xml
datax-modules/pom.xml
+2
-0
pom.xml
datax-tools/datax-tool-monitor/pom.xml
+10
-0
pom.xml
pom.xml
+1
-0
No files found.
datax-modules/flowable-service-parent/flowable-modeler/pom.xml
0 → 100644
View file @
09114c91
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
flowable-service-parent
</artifactId>
<groupId>
cn.datax
</groupId>
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
flowable-modeler
</artifactId>
<dependencies>
<!--web 模块-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.hibernate.validator
</groupId>
<artifactId>
hibernate-validator
</artifactId>
</exclusion>
<exclusion>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
${fastjson.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-spring-boot-starter
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-ui-modeler-logic
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
<dependency>
<groupId>
org.flowable
</groupId>
<artifactId>
flowable-ui-modeler-conf
</artifactId>
<version>
${flowable.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
datax-modules/flowable-service-parent/flowable-modeler/src/main/java/cn/datax/service/flowable/modeler/DataxFlowableModelerApplication.java
0 → 100644
View file @
09114c91
package
cn
.
datax
.
service
.
flowable
.
modeler
;
import
org.flowable.ui.modeler.conf.ApplicationConfiguration
;
import
org.flowable.ui.modeler.servlet.AppDispatcherServletConfiguration
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.Import
;
@Import
({
ApplicationConfiguration
.
class
,
AppDispatcherServletConfiguration
.
class
})
@EnableDiscoveryClient
@SpringBootApplication
public
class
DataxFlowableModelerApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
DataxFlowableModelerApplication
.
class
,
args
);
}
}
datax-modules/flowable-service-parent/flowable-modeler/src/main/java/org/flowable/ui/common/rest/idm/remote/RemoteAccountResource.java
0 → 100644
View file @
09114c91
package
org
.
flowable
.
ui
.
common
.
rest
.
idm
.
remote
;
import
org.flowable.ui.common.model.UserRepresentation
;
import
org.flowable.ui.common.security.DefaultPrivileges
;
import
org.flowable.ui.common.service.exception.NotFoundException
;
import
org.flowable.ui.common.service.idm.RemoteIdmService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/app"
)
public
class
RemoteAccountResource
{
@Autowired
private
RemoteIdmService
remoteIdmService
;
/**
* GET /rest/account -> get the current user.
*/
@RequestMapping
(
value
=
"/rest/account"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json"
)
public
UserRepresentation
getAccount
()
{
// UserRepresentation userRepresentation = null;
// String currentUserId = SecurityUtils.getCurrentUserId();
// if (currentUserId != null) {
// RemoteUser remoteUser = remoteIdmService.getUser(currentUserId);
// if (remoteUser != null) {
// userRepresentation = new UserRepresentation(remoteUser);
//
// if (remoteUser.getGroups() != null && remoteUser.getGroups().size() > 0) {
// List<GroupRepresentation> groups = new ArrayList<>();
// for (RemoteGroup remoteGroup : remoteUser.getGroups()) {
// groups.add(new GroupRepresentation(remoteGroup));
// }
// userRepresentation.setGroups(groups);
// }
//
// if (remoteUser.getPrivileges() != null && remoteUser.getPrivileges().size() > 0) {
// userRepresentation.setPrivileges(remoteUser.getPrivileges());
// }
//
// }
// }
UserRepresentation
userRepresentation
=
new
UserRepresentation
();
userRepresentation
.
setFirstName
(
"admin"
);
userRepresentation
.
setLastName
(
"admin"
);
userRepresentation
.
setFullName
(
"admin"
);
userRepresentation
.
setId
(
"admin"
);
List
<
String
>
pris
=
new
ArrayList
<>();
pris
.
add
(
DefaultPrivileges
.
ACCESS_MODELER
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_IDM
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_ADMIN
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_TASK
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_REST_API
);
userRepresentation
.
setPrivileges
(
pris
);
if
(
userRepresentation
!=
null
)
{
return
userRepresentation
;
}
else
{
throw
new
NotFoundException
();
}
}
}
datax-modules/flowable-service-parent/flowable-modeler/src/main/java/org/flowable/ui/common/security/SecurityUtils.java
0 → 100644
View file @
09114c91
package
org
.
flowable
.
ui
.
common
.
security
;
import
org.flowable.idm.api.User
;
import
org.flowable.ui.common.model.RemoteUser
;
import
org.flowable.ui.common.security.DefaultPrivileges
;
import
org.flowable.ui.common.security.FlowableAppUser
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Utility class for Spring Security.
*/
public
class
SecurityUtils
{
private
static
User
assumeUser
;
private
SecurityUtils
()
{
}
/**
* Get the login of the current user.
*/
public
static
String
getCurrentUserId
()
{
User
user
=
getCurrentUserObject
();
if
(
user
!=
null
)
{
return
user
.
getId
();
}
return
null
;
}
/**
* @return the {@link User} object associated with the current logged in user.
*/
public
static
User
getCurrentUserObject
()
{
if
(
assumeUser
!=
null
)
{
return
assumeUser
;
}
// User user = null;
// FlowableAppUser appUser = getCurrentFlowableAppUser();
// if (appUser != null) {
// user = appUser.getUserObject();
// }
RemoteUser
user
=
new
RemoteUser
();
// FlowableAppUser appUser = getCurrentFlowableAppUser();
// if (appUser != null) {
// user = appUser.getUserObject();
// }
user
.
setId
(
"admin"
);
user
.
setDisplayName
(
"admin"
);
user
.
setFirstName
(
"admin"
);
user
.
setLastName
(
"admin"
);
user
.
setEmail
(
"admin@admin.com"
);
user
.
setPassword
(
"admin"
);
List
<
String
>
pris
=
new
ArrayList
<>();
pris
.
add
(
DefaultPrivileges
.
ACCESS_MODELER
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_IDM
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_ADMIN
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_TASK
);
pris
.
add
(
DefaultPrivileges
.
ACCESS_REST_API
);
user
.
setPrivileges
(
pris
);
return
user
;
}
public
static
FlowableAppUser
getCurrentFlowableAppUser
()
{
FlowableAppUser
user
=
null
;
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
if
(
securityContext
!=
null
&&
securityContext
.
getAuthentication
()
!=
null
)
{
Object
principal
=
securityContext
.
getAuthentication
().
getPrincipal
();
if
(
principal
instanceof
FlowableAppUser
)
{
user
=
(
FlowableAppUser
)
principal
;
}
}
return
user
;
}
public
static
boolean
currentUserHasCapability
(
String
capability
)
{
FlowableAppUser
user
=
getCurrentFlowableAppUser
();
for
(
GrantedAuthority
grantedAuthority
:
user
.
getAuthorities
())
{
if
(
capability
.
equals
(
grantedAuthority
.
getAuthority
()))
{
return
true
;
}
}
return
false
;
}
public
static
void
assumeUser
(
User
user
)
{
assumeUser
=
user
;
}
public
static
void
clearAssumeUser
()
{
assumeUser
=
null
;
}
}
datax-modules/flowable-service-parent/flowable-modeler/src/main/java/org/flowable/ui/modeler/conf/SecurityConfiguration.java
0 → 100644
View file @
09114c91
package
org
.
flowable
.
ui
.
modeler
.
conf
;
import
org.flowable.ui.common.properties.FlowableRestAppProperties
;
import
org.flowable.ui.common.security.ActuatorRequestMatcher
;
import
org.flowable.ui.common.security.ClearFlowableCookieLogoutHandler
;
import
org.flowable.ui.common.security.DefaultPrivileges
;
import
org.flowable.ui.modeler.properties.FlowableModelerAppProperties
;
import
org.flowable.ui.modeler.security.AjaxLogoutSuccessHandler
;
import
org.flowable.ui.modeler.security.RemoteIdmAuthenticationProvider
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest
;
import
org.springframework.boot.actuate.health.HealthEndpoint
;
import
org.springframework.boot.actuate.info.InfoEndpoint
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.web.header.writers.XXssProtectionHeaderWriter
;
/**
* Based on http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/#multiple-httpsecurity
*
* @author Joram Barrez
* @author Tijs Rademakers
* @author Filip Hrisafov
*/
@Configuration
@EnableWebSecurity
public
class
SecurityConfiguration
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
org
.
flowable
.
ui
.
modeler
.
conf
.
SecurityConfiguration
.
class
);
public
static
final
String
REST_ENDPOINTS_PREFIX
=
"/app/rest"
;
@Autowired
protected
RemoteIdmAuthenticationProvider
authenticationProvider
;
// @Bean
// public FlowableCookieFilterRegistrationBean flowableCookieFilterRegistrationBean(RemoteIdmService remoteIdmService, FlowableCommonAppProperties properties) {
// FlowableCookieFilterRegistrationBean filter = new FlowableCookieFilterRegistrationBean(remoteIdmService, properties);
// filter.addUrlPatterns("/app/*");
// filter.setRequiredPrivileges(Collections.singletonList(DefaultPrivileges.ACCESS_MODELER));
// return filter;
// }
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
{
// Default auth (database backed)
try
{
auth
.
authenticationProvider
(
authenticationProvider
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"Could not configure authentication mechanism:"
,
e
);
}
}
@Configuration
@Order
(
10
)
public
static
class
FormLoginWebSecurityConfigurerAdapter
extends
WebSecurityConfigurerAdapter
{
// @Autowired
// protected FlowableCookieFilterRegistrationBean flowableCookieFilterRegistrationBean;
@Autowired
protected
AjaxLogoutSuccessHandler
ajaxLogoutSuccessHandler
;
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
sessionManagement
()
.
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
)
.
and
()
// .addFilterBefore(flowableCookieFilterRegistrationBean.getFilter(), UsernamePasswordAuthenticationFilter.class)
.
logout
()
.
logoutUrl
(
"/app/logout"
)
.
logoutSuccessHandler
(
ajaxLogoutSuccessHandler
)
.
addLogoutHandler
(
new
ClearFlowableCookieLogoutHandler
())
.
and
()
.
csrf
()
.
disable
()
// Disabled, cause enabling it will cause sessions
.
headers
()
.
frameOptions
()
.
sameOrigin
()
.
addHeaderWriter
(
new
XXssProtectionHeaderWriter
())
.
and
()
.
authorizeRequests
()
// .antMatchers(REST_ENDPOINTS_PREFIX + "/**").hasAuthority(DefaultPrivileges.ACCESS_MODELER);
.
antMatchers
(
REST_ENDPOINTS_PREFIX
+
"/**"
).
permitAll
();
}
}
//
// BASIC AUTH
//
@Configuration
@Order
(
1
)
public
static
class
ApiWebSecurityConfigurationAdapter
extends
WebSecurityConfigurerAdapter
{
protected
final
FlowableRestAppProperties
restAppProperties
;
protected
final
FlowableModelerAppProperties
modelerAppProperties
;
public
ApiWebSecurityConfigurationAdapter
(
FlowableRestAppProperties
restAppProperties
,
FlowableModelerAppProperties
modelerAppProperties
)
{
this
.
restAppProperties
=
restAppProperties
;
this
.
modelerAppProperties
=
modelerAppProperties
;
}
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
sessionManagement
()
.
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
)
.
and
()
.
csrf
()
.
disable
();
http
.
antMatcher
(
"/api/**"
).
authorizeRequests
().
antMatchers
(
"/api/**"
).
permitAll
();
// if (modelerAppProperties.isRestEnabled()) {
//
// if (restAppProperties.isVerifyRestApiPrivilege()) {
// http.antMatcher("/api/**").authorizeRequests().antMatchers("/api/**").hasAuthority(DefaultPrivileges.ACCESS_REST_API).and().httpBasic();
// } else {
// http.antMatcher("/api/**").authorizeRequests().antMatchers("/api/**").authenticated().and().httpBasic();
//
// }
//
// } else {
// http.antMatcher("/api/**").authorizeRequests().antMatchers("/api/**").denyAll();
//
// }
}
}
//
// Actuator
//
@ConditionalOnClass
(
EndpointRequest
.
class
)
@Configuration
@Order
(
5
)
// Actuator configuration should kick in before the Form Login there should always be http basic for the endpoints
public
static
class
ActuatorWebSecurityConfigurationAdapter
extends
WebSecurityConfigurerAdapter
{
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
sessionManagement
()
.
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
)
.
and
()
.
csrf
()
.
disable
();
http
.
requestMatcher
(
new
ActuatorRequestMatcher
())
.
authorizeRequests
()
.
requestMatchers
(
EndpointRequest
.
to
(
InfoEndpoint
.
class
,
HealthEndpoint
.
class
)).
authenticated
()
.
requestMatchers
(
EndpointRequest
.
toAnyEndpoint
()).
hasAnyAuthority
(
DefaultPrivileges
.
ACCESS_ADMIN
)
.
and
().
httpBasic
();
}
}
}
datax-modules/flowable-service-parent/flowable-modeler/src/main/resources/application.yml
0 → 100644
View file @
09114c91
server
:
port
:
8989
spring
:
application
:
name
:
datax-flowable-modeler
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/data_flowable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
1234@abcd
# 注册中心配置
eureka
:
instance
:
lease-renewal-interval-in-seconds
:
20
client
:
register-with-eureka
:
true
fetch-registry
:
true
instance-info-replication-interval-seconds
:
30
registry-fetch-interval-seconds
:
3
service-url
:
defaultZone
:
http://localhost:8610/eureka
flowable
:
common
:
app
:
idm-url
:
http://localhost:8989/flowable-idm
idm-admin
:
user
:
admin
password
:
admin
async-executor-activate
:
false
#关闭定时任务JOB
database-schema-update
:
false
#第一次true生成表后改成false
\ No newline at end of file
datax-modules/flowable-service-parent/pom.xml
0 → 100644
View file @
09114c91
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
datax-modules
</artifactId>
<groupId>
cn.datax
</groupId>
<version>
1.0.0
</version>
</parent>
<packaging>
pom
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
flowable-service-parent
</artifactId>
<modules>
<module>
flowable-modeler
</module>
</modules>
</project>
\ No newline at end of file
datax-modules/pom.xml
View file @
09114c91
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<module>
system-service-parent
</module>
<module>
system-service-parent
</module>
<module>
file-service-parent
</module>
<module>
file-service-parent
</module>
<module>
email-service-parent
</module>
<module>
email-service-parent
</module>
<module>
flowable-service-parent
</module>
</modules>
</modules>
</project>
</project>
\ No newline at end of file
datax-tools/datax-tool-monitor/pom.xml
View file @
09114c91
...
@@ -22,6 +22,16 @@
...
@@ -22,6 +22,16 @@
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
pom.xml
View file @
09114c91
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
<aliyun-sdk-oss.version>
3.6.0
</aliyun-sdk-oss.version>
<aliyun-sdk-oss.version>
3.6.0
</aliyun-sdk-oss.version>
<qiniu-java-sdk.version>
7.2.25
</qiniu-java-sdk.version>
<qiniu-java-sdk.version>
7.2.25
</qiniu-java-sdk.version>
<fastdfs-client.version>
1.26.7
</fastdfs-client.version>
<fastdfs-client.version>
1.26.7
</fastdfs-client.version>
<flowable.version>
6.4.2
</flowable.version>
</properties>
</properties>
<modules>
<modules>
...
...
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