Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
edcff2cb
提交
edcff2cb
编写于
5月 23, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zhouweidong@lab.ibiz5.com 部署微服务接口
上级
a7b495d9
变更
20
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
167 行增加
和
310 行删除
+167
-310
config.xml
config.xml
+5
-5
Dockerfile
ibzuaa-app/ibzuaa-app-web/src/main/docker/Dockerfile
+1
-1
ibzuaa-app-web.yaml
...aa-app/ibzuaa-app-web/src/main/docker/ibzuaa-app-web.yaml
+1
-15
webApplication.java
...-app-web/src/main/java/cn/ibizlab/web/webApplication.java
+1
-1
DevBootApplication.java
ibzuaa-boot/src/main/java/cn/ibizlab/DevBootApplication.java
+10
-0
h2_table.xml
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
+4
-219
Dockerfile
...a-provider/ibzuaa-provider-api/src/main/docker/Dockerfile
+1
-1
ibzuaa-provider-api.yaml
...uaa-provider-api/src/main/docker/ibzuaa-provider-api.yaml
+13
-1
apiSecurityConfig.java
...rc/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
+31
-7
ibzuaaapiApplication.java
...pi/src/main/java/cn/ibizlab/api/ibzuaaapiApplication.java
+9
-1
SYS_AUTHLOGResource.java
...rc/main/java/cn/ibizlab/api/rest/SYS_AUTHLOGResource.java
+0
-7
SYS_PERMISSIONResource.java
...main/java/cn/ibizlab/api/rest/SYS_PERMISSIONResource.java
+0
-7
SYS_PSAPPMENUITEMResource.java
...n/java/cn/ibizlab/api/rest/SYS_PSAPPMENUITEMResource.java
+0
-7
SYS_PSDEOPPRIVResource.java
...main/java/cn/ibizlab/api/rest/SYS_PSDEOPPRIVResource.java
+0
-7
SYS_ROLEResource.java
...i/src/main/java/cn/ibizlab/api/rest/SYS_ROLEResource.java
+0
-7
SYS_ROLE_PERMISSIONResource.java
...java/cn/ibizlab/api/rest/SYS_ROLE_PERMISSIONResource.java
+3
-10
SYS_USERResource.java
...i/src/main/java/cn/ibizlab/api/rest/SYS_USERResource.java
+0
-7
SYS_USER_ROLEResource.java
.../main/java/cn/ibizlab/api/rest/SYS_USER_ROLEResource.java
+0
-7
AuthPermissionEvaluator.java
...ava/cn/ibizlab/util/security/AuthPermissionEvaluator.java
+49
-0
FeignRequestInterceptor.java
...ain/java/cn/ibizlab/util/web/FeignRequestInterceptor.java
+39
-0
未找到文件。
config.xml
浏览文件 @
edcff2cb
...
...
@@ -37,11 +37,11 @@
git clone -b master $para2 ibzuaa/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzuaa/
mvn clean package -P
web
cd ibzuaa-
app/ibzuaa-app-web
mvn -P
web
docker:build
mvn -P
web
docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzuaa-
app-web.yaml ibzlab-rt --with-registry-auth
mvn clean package -P
api
cd ibzuaa-
provider/ibzuaa-provider-api
mvn -P
api
docker:build
mvn -P
api
docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzuaa-
provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
...
...
ibzuaa-app/ibzuaa-app-web/src/main/docker/Dockerfile
浏览文件 @
edcff2cb
...
...
@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-app-web.jar
EXPOSE
30002
EXPOSE
8080
ADD
ibzuaa-app-web.jar /ibzuaa-app-web.jar
ibzuaa-app/ibzuaa-app-web/src/main/docker/ibzuaa-app-web.yaml
浏览文件 @
edcff2cb
...
...
@@ -3,23 +3,9 @@ services:
ibzuaa-app-web
:
image
:
registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-app-web:latest
ports
:
-
"
30002:30002
"
-
"
8080:8080
"
networks
:
-
agent_network
environment
:
-
SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
-
SERVER_PORT=30002
-
SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
-
SPRING_REDIS_HOST=172.16.100.243
-
SPRING_REDIS_PORT=6379
-
SPRING_REDIS_DATABASE=0
-
SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
-
SPRING_DATASOURCE_PASSWORD=@6dEfb3@
-
SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
-
SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
-
SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
-
ABC=1
-
DEC=2
deploy
:
mode
:
replicated
replicas
:
1
...
...
ibzuaa-app/ibzuaa-app-web/src/main/java/cn/ibizlab/web/webApplication.java
浏览文件 @
edcff2cb
...
...
@@ -23,7 +23,7 @@ import java.util.List;
@Configuration
@EnableFeignClients
(
basePackages
=
{
"cn.ibizlab"
})
@EnableZuulProxy
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
})
@ComponentScan
(
basePackages
=
{
"cn.ibizlab
.web"
,
"cn.ibizlab.util
"
})
@MapperScan
(
"cn.ibizlab.*.mapper"
)
@SpringBootApplication
(
exclude
=
{
org
.
springframework
.
boot
.
autoconfigure
.
security
.
servlet
.
SecurityAutoConfiguration
.
class
,
...
...
ibzuaa-boot/src/main/java/cn/ibizlab/DevBootApplication.java
浏览文件 @
edcff2cb
...
...
@@ -4,11 +4,13 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
org.springframework.context.annotation.ComponentScan
;
import
java.util.List
;
@Slf4j
...
...
@@ -19,6 +21,14 @@ import java.util.List;
@SpringBootApplication
(
exclude
=
{
org
.
springframework
.
boot
.
autoconfigure
.
mongo
.
MongoAutoConfiguration
.
class
,
})
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.xxx.rest.xxx"),
// }
)
@Import
({
org
.
springframework
.
cloud
.
openfeign
.
FeignClientsConfiguration
.
class
})
public
class
DevBootApplication
extends
WebMvcConfigurerAdapter
{
public
static
void
main
(
String
[]
args
)
{
...
...
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
edcff2cb
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext=
"http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
>
<!--输出实体[SYS_AUTHLOG]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_authlog-34-1"
>
<createTable
tableName=
"IBZAUTHLOG"
>
<column
name=
"LOGID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_AUTHLOG_LOGID"
/>
</column>
<column
name=
"USERNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PERSONNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"DOMAIN"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"AUTHTIME"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"IPADDR"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"MACADDR"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"USERAGENT"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"AUTHCODE"
remarks=
""
type=
"VARCHAR(15)"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PSDEOPPRIV]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_psdeoppriv-98-2"
>
<createTable
tableName=
"IBZPSDEOPPRIV"
>
<column
name=
"SYS_PSDEOPPRIVID"
remarks=
""
type=
"VARCHAR(200)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PSDEOPPRIV_SYS_PSDEOPPR"
/>
</column>
<column
name=
"SYS_PSDEOPPRIVNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"PSDATAENTITYID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSDATAENTITYNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSDEDATARANGEID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSDEDATARANGENAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSYSMODULEID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSYSMODULENAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSYSTEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"PSSOURCEID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSOURCENAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSOURCETYPE"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_ROLE_PERMISSION]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_role_permission-68-3"
>
<createTable
tableName=
"IBZROLE_PERMISSION"
>
<column
name=
"SYS_ROLE_PERMISSIONID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_ROLE_PERMISSION_SYS_ROL"
/>
</column>
<column
name=
"SYS_ROLE_PERMISSIONNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"SYS_ROLEID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"SYS_ROLENAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"SYS_PERMISSIONID"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"SYS_PERMISSIONNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"SYSTEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"UPDATEMAN"
remarks=
""
type=
"VARCHAR(60)"
>
</column>
<column
name=
"CREATEMAN"
remarks=
""
type=
"VARCHAR(60)"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PSSYSUNIRES]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_pssysunires-91-4"
>
<createTable
tableName=
"IBZPSSYSUNIRES"
>
<column
name=
"SYS_PSSYSUNIRESID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PSSYSUNIRES_SYS_PSSYSUN"
/>
</column>
<column
name=
"SYS_PSSYSUNIRESNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"UNIRESCODE"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_USER_ROLE]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_user_role-47-5"
>
<createTable
tableName=
"IBZUSER_ROLE"
>
<column
name=
"SYS_USER_ROLEID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_USER_ROLE_SYS_USER_ROLE"
/>
</column>
<column
name=
"SYS_USER_ROLENAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"SYS_ROLEID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"SYS_ROLENAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"SYS_USERID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"SYS_USERNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PERMISSION]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_permission-191-6"
>
<createTable
tableName=
"IBZPERMISSION"
>
<column
name=
"SYS_PERMISSIONID"
remarks=
""
type=
"VARCHAR(200)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PERMISSION_SYS_PERMISSI"
/>
</column>
<column
name=
"SYS_PERMISSIONNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"SYSTEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PERMISSIONTYPE"
remarks=
""
type=
"VARCHAR(60)"
>
</column>
<column
name=
"ENABLE"
remarks=
""
type=
"INT"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_ROLE]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_role-81-7"
>
<createTable
tableName=
"IBZROLE"
>
<column
name=
"SYS_ROLEID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_ROLE_SYS_ROLEID"
/>
</column>
<column
name=
"SYS_ROLENAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"MEMO"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PSSYSTEM]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_pssystem-9-8"
>
<createTable
tableName=
"IBZPSSYSTEM"
>
<column
name=
"PSSYSTEMID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PSSYSTEM_PSSYSTEMID"
/>
</column>
<column
name=
"PSSYSTEMNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_PSAPPMENUITEM]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_psappmenuitem-98-9"
>
<createTable
tableName=
"IBZPSAPPMENUITEM"
>
<column
name=
"SYS_PSAPPMENUITEMID"
remarks=
""
type=
"VARCHAR(200)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PSAPPMENUITEM_SYS_PSAPP"
/>
</column>
<column
name=
"SYS_PSAPPMENUITEMNAME"
remarks=
""
type=
"VARCHAR(200)"
>
</column>
<column
name=
"PSAPPID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSAPPNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSAPPMENUID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSAPPMENUITEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSAPPPMENUITEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSAPPMENUNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"PSSYSTEMID"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
<column
name=
"CREATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
</createTable>
</changeSet>
<!--输出实体[SYS_AUTHLOG]外键关系 -->
<!--输出实体[SYS_PSDEOPPRIV]外键关系 -->
<!--输出实体[SYS_ROLE_PERMISSION]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-sys_role_permission-68-10"
>
<addForeignKeyConstraint
baseColumnNames=
"SYS_PERMISSIONID"
baseTableName=
"IBZROLE_PERMISSION"
constraintName=
"DER1N_SYS_ROLE_PERMISSION_SYS_"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"SYS_PERMISSIONID"
referencedTableName=
"IBZPERMISSION"
validate=
"true"
/>
</changeSet>
<!--输出实体[SYS_PSSYSUNIRES]外键关系 -->
<!--输出实体[SYS_USER_ROLE]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-sys_user_role-47-12"
>
<addForeignKeyConstraint
baseColumnNames=
"SYS_ROLEID"
baseTableName=
"IBZUSER_ROLE"
constraintName=
"DER1N_SYS_USER_ROLE_SYS_ROLE_S"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"SYS_ROLEID"
referencedTableName=
"IBZROLE"
validate=
"true"
/>
</changeSet>
<!--输出实体[SYS_PERMISSION]外键关系 -->
<!--输出实体[SYS_ROLE]外键关系 -->
<!--输出实体[SYS_PSSYSTEM]外键关系 -->
<!--输出实体[SYS_PSAPPMENUITEM]外键关系 -->
</databaseChangeLog>
!!!!模版产生代码错误:----
FTL stack trace ("~" means nesting-related):
- Failed at: #if de.getAllPSDEDBConfigs()??
&&
de... [in template "CODETEMPL_zh_CN" at line 14, column 5]
----
\ No newline at end of file
ibzuaa-provider/ibzuaa-provider-api/src/main/docker/Dockerfile
浏览文件 @
edcff2cb
...
...
@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-provider-api.jar
EXPOSE
8081
EXPOSE
40002
ADD
ibzuaa-provider-api.jar /ibzuaa-provider-api.jar
ibzuaa-provider/ibzuaa-provider-api/src/main/docker/ibzuaa-provider-api.yaml
浏览文件 @
edcff2cb
...
...
@@ -3,9 +3,21 @@ services:
ibzuaa-provider-api
:
image
:
registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-provider-api:latest
ports
:
-
"
8081:8081
"
-
"
40002:40002
"
networks
:
-
agent_network
environment
:
-
SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
-
SERVER_PORT=40002
-
SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
-
SPRING_REDIS_HOST=172.16.100.243
-
SPRING_REDIS_PORT=6379
-
SPRING_REDIS_DATABASE=0
-
SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
-
SPRING_DATASOURCE_PASSWORD=@6dEfb3@
-
SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
-
SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
-
SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
deploy
:
mode
:
replicated
replicas
:
1
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
浏览文件 @
edcff2cb
...
...
@@ -40,6 +40,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
AuthorizationTokenFilter
authenticationTokenFilter
;
@Value
(
"${ibiz.auth.path:v7/login}"
)
private
String
loginPath
;
@Value
(
"${ibiz.auth.logoutpath:v7/logout}"
)
private
String
logoutPath
;
@Value
(
"${ibiz.file.uploadpath:ibizutil/upload}"
)
private
String
uploadpath
;
@Value
(
"${ibiz.file.downloadpath:ibizutil/download}"
)
private
String
downloadpath
;
@Value
(
"${ibiz.file.previewpath:ibizutil/preview}"
)
private
String
previewpath
;
@Autowired
public
void
configureGlobal
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
...
...
@@ -67,13 +82,16 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected
void
configure
(
HttpSecurity
httpSecurity
)
throws
Exception
{
httpSecurity
httpSecurity
// 禁用 CSRF
.
csrf
().
disable
()
// 授权异常
.
exceptionHandling
().
authenticationEntryPoint
(
unauthorizedHandler
).
and
()
// 不创建会话
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
// 过滤请求
.
authorizeRequests
()
.
antMatchers
(
...
...
@@ -88,15 +106,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
"/**/fonts/**"
,
"/**/js/**"
,
"/**/img/**"
,
"/"
,
"/webjars/**"
,
"/swagger-resources/**"
,
"/v2/**"
"/"
).
permitAll
()
// 服务中暂时只为重构用户身份,不进行身份认证
.
anyRequest
().
permitAll
()
//放行登录请求
.
antMatchers
(
HttpMethod
.
POST
,
"/"
+
loginPath
).
permitAll
()
//放行注销请求
.
antMatchers
(
HttpMethod
.
GET
,
"/"
+
logoutPath
).
permitAll
()
// 文件操作
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
httpSecurity
.
addFilterBefore
(
authenticationTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
}
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/ibzuaaapiApplication.java
浏览文件 @
edcff2cb
...
...
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.mybatis.spring.annotation.MapperScan
;
...
...
@@ -18,13 +19,20 @@ import java.util.List;
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
})
@ComponentScan
(
basePackages
=
{
"cn.ibizlab"
}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.api.rest.xxx"),
// }
)
@EnableMongoRepositories
(
basePackages
=
{
"cn.ibizlab"
})
@MapperScan
(
"cn.ibizlab.*.mapper"
)
@SpringBootApplication
(
exclude
=
{
org
.
springframework
.
boot
.
autoconfigure
.
security
.
servlet
.
SecurityAutoConfiguration
.
class
,
org
.
springframework
.
boot
.
autoconfigure
.
mongo
.
MongoAutoConfiguration
.
class
,
})
@Import
({
org
.
springframework
.
cloud
.
openfeign
.
FeignClientsConfiguration
.
class
})
@EnableFeignClients
(
basePackages
=
{
"cn.ibizlab"
})
public
class
ibzuaaapiApplication
extends
WebMvcConfigurerAdapter
{
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_AUTHLOGResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_AUTHLOG
;
import
cn.ibizlab.core.uaa.service.ISYS_AUTHLOGService
;
import
cn.ibizlab.core.uaa.filter.SYS_AUTHLOGSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_AUTHLOG"
})
@RestController
(
"api-sys_authlog"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_PERMISSIONResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_PERMISSION
;
import
cn.ibizlab.core.uaa.service.ISYS_PERMISSIONService
;
import
cn.ibizlab.core.uaa.filter.SYS_PERMISSIONSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_PERMISSION"
})
@RestController
(
"api-sys_permission"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_PSAPPMENUITEMResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_PSAPPMENUITEM
;
import
cn.ibizlab.core.uaa.service.ISYS_PSAPPMENUITEMService
;
import
cn.ibizlab.core.uaa.filter.SYS_PSAPPMENUITEMSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_PSAPPMENUITEM"
})
@RestController
(
"api-sys_psappmenuitem"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_PSDEOPPRIVResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_PSDEOPPRIV
;
import
cn.ibizlab.core.uaa.service.ISYS_PSDEOPPRIVService
;
import
cn.ibizlab.core.uaa.filter.SYS_PSDEOPPRIVSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_PSDEOPPRIV"
})
@RestController
(
"api-sys_psdeoppriv"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_ROLEResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_ROLE
;
import
cn.ibizlab.core.uaa.service.ISYS_ROLEService
;
import
cn.ibizlab.core.uaa.filter.SYS_ROLESearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_ROLE"
})
@RestController
(
"api-sys_role"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_ROLE_PERMISSIONResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_ROLE_PERMISSION
;
import
cn.ibizlab.core.uaa.service.ISYS_ROLE_PERMISSIONService
;
import
cn.ibizlab.core.uaa.filter.SYS_ROLE_PERMISSIONSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_ROLE_PERMISSION"
})
@RestController
(
"api-sys_role_permission"
)
...
...
@@ -112,7 +105,7 @@ public class SYS_ROLE_PERMISSIONResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
sys_role_permissionService
.
checkKey
(
sys_role_permissionMapping
.
toDomain
(
sys_role_permissiondto
)));
}
@PreAuthorize
(
"has
AnyAuthority('ROLE_SUPERADMIN','ibzuaa-SYS_ROLE_PERMISSION-Save-all'
)"
)
@PreAuthorize
(
"has
Permission('','Save',{'Sql',this.sys_role_permissionMapping,#sys_role_permissiondto}
)"
)
@ApiOperation
(
value
=
"Save"
,
tags
=
{
"SYS_ROLE_PERMISSION"
},
notes
=
"Save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sys_role_permissions/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
SYS_ROLE_PERMISSIONDTO
sys_role_permissiondto
)
{
...
...
@@ -254,7 +247,7 @@ public class SYS_ROLE_PERMISSIONResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
sys_role_permissionService
.
checkKey
(
sys_role_permissionMapping
.
toDomain
(
sys_role_permissiondto
)));
}
@PreAuthorize
(
"has
AnyAuthority('ROLE_SUPERADMIN','ibzuaa-SYS_ROLE_PERMISSION-Save-all'
)"
)
@PreAuthorize
(
"has
Permission('','Save',{'Sql',this.sys_role_permissionMapping,#sys_role_permissiondto}
)"
)
@ApiOperation
(
value
=
"SaveBySYS_PERMISSION"
,
tags
=
{
"SYS_ROLE_PERMISSION"
},
notes
=
"SaveBySYS_PERMISSION"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sys_permissions/{sys_permission_id}/sys_role_permissions/save"
)
public
ResponseEntity
<
Boolean
>
saveBySYS_PERMISSION
(
@PathVariable
(
"sys_permission_id"
)
String
sys_permission_id
,
@RequestBody
SYS_ROLE_PERMISSIONDTO
sys_role_permissiondto
)
{
...
...
@@ -411,7 +404,7 @@ public class SYS_ROLE_PERMISSIONResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
sys_role_permissionService
.
checkKey
(
sys_role_permissionMapping
.
toDomain
(
sys_role_permissiondto
)));
}
@PreAuthorize
(
"has
AnyAuthority('ROLE_SUPERADMIN','ibzuaa-SYS_ROLE_PERMISSION-Save-all'
)"
)
@PreAuthorize
(
"has
Permission('','Save',{'Sql',this.sys_role_permissionMapping,#sys_role_permissiondto}
)"
)
@ApiOperation
(
value
=
"SaveBySYS_ROLE"
,
tags
=
{
"SYS_ROLE_PERMISSION"
},
notes
=
"SaveBySYS_ROLE"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/sys_roles/{sys_role_id}/sys_role_permissions/save"
)
public
ResponseEntity
<
Boolean
>
saveBySYS_ROLE
(
@PathVariable
(
"sys_role_id"
)
String
sys_role_id
,
@RequestBody
SYS_ROLE_PERMISSIONDTO
sys_role_permissiondto
)
{
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_USERResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_USER
;
import
cn.ibizlab.core.uaa.service.ISYS_USERService
;
import
cn.ibizlab.core.uaa.filter.SYS_USERSearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_USER"
})
@RestController
(
"api-sys_user"
)
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/SYS_USER_ROLEResource.java
浏览文件 @
edcff2cb
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
...
...
@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.util.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.api.dto.*
;
import
cn.ibizlab.api.mapping.*
;
import
cn.ibizlab.core.uaa.domain.SYS_USER_ROLE
;
import
cn.ibizlab.core.uaa.service.ISYS_USER_ROLEService
;
import
cn.ibizlab.core.uaa.filter.SYS_USER_ROLESearchContext
;
@Slf4j
@Api
(
tags
=
{
"SYS_USER_ROLE"
})
@RestController
(
"api-sys_user_role"
)
...
...
ibzuaa-util/src/main/java/cn/ibizlab/util/security/AuthPermissionEvaluator.java
浏览文件 @
edcff2cb
...
...
@@ -104,6 +104,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if
(
action
.
equalsIgnoreCase
(
"create"
)){
return
createBatchActionPermissionValid
(
entityList
,
dataRangeList
);
}
else
if
(
action
.
equalsIgnoreCase
(
"save"
)){
return
saveBatchActionPermissionValid
(
deStorageMode
,
entityList
,
dataRangeList
);
}
else
{
if
(!
action
.
equalsIgnoreCase
(
"remove"
)){
ids
=
getIds
(
entity
,
entityList
);
...
...
@@ -157,6 +160,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if
(
dataRangeList
.
size
()==
0
)
return
false
;
if
(
action
.
equalsIgnoreCase
(
"save"
)){
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
String
keyFieldName
=
permissionField
.
get
(
keyFieldTag
);
Object
srfKey
=
entity
.
get
(
keyFieldName
);
if
(
ObjectUtils
.
isEmpty
(
srfKey
))
action
=
"create"
;
else
action
=
"update"
;
}
if
(
action
.
equalsIgnoreCase
(
"create"
)){
return
createActionPermissionValid
(
entity
,
dataRangeList
);
}
...
...
@@ -165,6 +177,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* 批save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private
boolean
saveBatchActionPermissionValid
(
String
deStorageMode
,
List
<
EntityBase
>
entityList
,
JSONArray
dataRangeList
)
{
if
(
entityList
==
null
||
entityList
.
size
()==
0
)
return
false
;
EntityBase
tempEntity
=
entityList
.
get
(
0
);
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
tempEntity
);
String
keyFieldName
=
permissionField
.
get
(
keyFieldTag
);
List
createList
=
new
ArrayList
();
List
<
String
>
updateList
=
new
ArrayList
();
for
(
EntityBase
entity
:
entityList
){
Object
id
=
entity
.
get
(
keyFieldName
);
if
(
ObjectUtils
.
isEmpty
(
id
))
createList
.
add
(
entity
);
else
updateList
.
add
(
String
.
valueOf
(
id
));
}
if
(
updateList
.
size
()>
0
){
boolean
isUpdate
=
otherBatchActionPermissionValidRouter
(
deStorageMode
,
tempEntity
,
updateList
,
dataRangeList
);
if
(!
isUpdate
)
return
false
;
}
if
(
createList
.
size
()>
0
){
boolean
isCreate
=
createBatchActionPermissionValid
(
entityList
,
dataRangeList
);
if
(!
isCreate
)
return
false
;
}
return
true
;
}
/**
* 批处理新建权限校验
* @param entityList
...
...
ibzuaa-util/src/main/java/cn/ibizlab/util/web/FeignRequestInterceptor.java
0 → 100644
浏览文件 @
edcff2cb
package
cn
.
ibizlab
.
util
.
web
;
import
feign.RequestInterceptor
;
import
feign.RequestTemplate
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Enumeration
;
/**
* feign请求拦截器
* 拦截所有使用feign发出的请求,附加原始请求Header参数及Token
*/
@Configuration
public
class
FeignRequestInterceptor
implements
RequestInterceptor
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Override
public
void
apply
(
RequestTemplate
requestTemplate
)
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
!=
null
){
HttpServletRequest
request
=
requestAttributes
.
getRequest
();
Enumeration
<
String
>
headerNames
=
request
.
getHeaderNames
();
if
(
headerNames
!=
null
)
{
while
(
headerNames
.
hasMoreElements
())
{
String
name
=
headerNames
.
nextElement
();
String
values
=
request
.
getHeader
(
name
);
requestTemplate
.
header
(
name
,
values
);
}
logger
.
info
(
"feign interceptor header:{}"
,
requestTemplate
);
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录