mirror of https://gitee.com/maxjhandsome/pig
Merge branch 'dev'
This commit is contained in:
commit
f13509b752
|
@ -0,0 +1,15 @@
|
||||||
|
### 版本信息
|
||||||
|
- pig版本:
|
||||||
|
- 操作系统:
|
||||||
|
- 是否修改包名:
|
||||||
|
|
||||||
|
### 报错信息 (注意格式化)
|
||||||
|
|
||||||
|
```angular2
|
||||||
|
这里粘贴代码或者、日志
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
###问题描述(包括回显步骤、截图 )
|
||||||
|
|
||||||
|
此项没有直接关闭、不予解决
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
**Pig Microservice Architecture**
|
**Pig Microservice Architecture**
|
||||||
|
|
||||||
- 基于 Spring Cloud Finchley 、Spring Security OAuth2 的RBAC权限管理系统
|
- 基于 Spring Cloud Greenwich 、Spring Security OAuth2 的RBAC权限管理系统
|
||||||
- 基于数据驱动视图的理念封装 Element-ui,即使没有 vue 的使用经验也能快速上手
|
- 基于数据驱动视图的理念封装 Element-ui,即使没有 vue 的使用经验也能快速上手
|
||||||
- 提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持
|
- 提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持
|
||||||
- 提供 lambda 、stream api 、webflux 的生产实践
|
- 提供 lambda 、stream api 、webflux 的生产实践
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
依赖 | 版本
|
依赖 | 版本
|
||||||
---|---
|
---|---
|
||||||
Spring Boot | 2.0.8.RELEASE
|
Spring Boot | 2.1.3.RELEASE
|
||||||
Spring Cloud | Finchley.SR3
|
Spring Cloud | Greenwich.RELEASE
|
||||||
Spring Security OAuth2 | 2.3.3
|
Spring Security OAuth2 | 2.3.3
|
||||||
Mybatis Plus | 3.1.0
|
Mybatis Plus | 3.1.0
|
||||||
hutool | 4.5.0
|
hutool | 4.5.0
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-auth</artifactId>
|
<artifactId>pig-auth</artifactId>
|
||||||
|
@ -39,13 +39,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--security-->
|
<!--security-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-security</artifactId>
|
<artifactId>pig-common-security</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--JDBC相关-->
|
<!--JDBC相关-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
||||||
import com.pig4cloud.pig.common.security.component.PigWebResponseExceptionTranslator;
|
import com.pig4cloud.pig.common.security.component.PigWebResponseExceptionTranslator;
|
||||||
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
|
import com.pig4cloud.pig.common.security.service.PigClientDetailsService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
@ -55,7 +56,8 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
||||||
private final RedisConnectionFactory redisConnectionFactory;
|
private final RedisConnectionFactory redisConnectionFactory;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
@SneakyThrows
|
||||||
|
public void configure(ClientDetailsServiceConfigurer clients) {
|
||||||
PigClientDetailsService clientDetailsService = new PigClientDetailsService(dataSource);
|
PigClientDetailsService clientDetailsService = new PigClientDetailsService(dataSource);
|
||||||
clientDetailsService.setSelectClientDetailsSql(SecurityConstants.DEFAULT_SELECT_STATEMENT);
|
clientDetailsService.setSelectClientDetailsSql(SecurityConstants.DEFAULT_SELECT_STATEMENT);
|
||||||
clientDetailsService.setFindClientDetailsSql(SecurityConstants.DEFAULT_FIND_STATEMENT);
|
clientDetailsService.setFindClientDetailsSql(SecurityConstants.DEFAULT_FIND_STATEMENT);
|
||||||
|
|
|
@ -18,6 +18,7 @@ package com.pig4cloud.pig.auth.config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.pig4cloud.pig.common.security.handler.MobileLoginSuccessHandler;
|
import com.pig4cloud.pig.common.security.handler.MobileLoginSuccessHandler;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -51,7 +52,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||||
private AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
|
private AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
@SneakyThrows
|
||||||
|
protected void configure(HttpSecurity http) {
|
||||||
http
|
http
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers(
|
.antMatchers(
|
||||||
|
@ -63,7 +65,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Override
|
@Override
|
||||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
@SneakyThrows
|
||||||
|
public AuthenticationManager authenticationManagerBean() {
|
||||||
return super.authenticationManagerBean();
|
return super.authenticationManagerBean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package com.pig4cloud.pig.auth.endpoint;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import com.pig4cloud.pig.common.security.service.PigUser;
|
import com.pig4cloud.pig.common.security.service.PigUser;
|
||||||
|
@ -64,18 +65,28 @@ public class PigTokenEndpoint {
|
||||||
*
|
*
|
||||||
* @param authHeader Authorization
|
* @param authHeader Authorization
|
||||||
*/
|
*/
|
||||||
@GetMapping("/logout")
|
@DeleteMapping("/logout")
|
||||||
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
|
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
|
||||||
if (StringUtils.hasText(authHeader)) {
|
if (StrUtil.isBlank(authHeader)) {
|
||||||
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
|
return R.<Boolean>builder()
|
||||||
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
|
.code(CommonConstants.FAIL)
|
||||||
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
|
.data(Boolean.FALSE)
|
||||||
return new R<>(false, "退出失败,token 为空");
|
.msg("退出失败,token 为空").build();
|
||||||
}
|
|
||||||
tokenStore.removeAccessToken(accessToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new R<>(Boolean.TRUE);
|
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
|
||||||
|
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
|
||||||
|
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
|
||||||
|
return R.<Boolean>builder()
|
||||||
|
.code(CommonConstants.FAIL)
|
||||||
|
.data(Boolean.FALSE)
|
||||||
|
.msg("退出失败,token 无效").build();
|
||||||
|
}
|
||||||
|
tokenStore.removeAccessToken(accessToken);
|
||||||
|
return R.<Boolean>builder()
|
||||||
|
.code(CommonConstants.SUCCESS)
|
||||||
|
.data(Boolean.TRUE)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +117,7 @@ public class PigTokenEndpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Map<String, String>> list = new ArrayList<>();
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
if (StringUtils.isEmpty(MapUtil.getInt(params, CURRENT)) || StringUtils.isEmpty(MapUtil.getInt(params, CURRENT))) {
|
if (StringUtils.isEmpty(MapUtil.getInt(params, CURRENT)) || StringUtils.isEmpty(MapUtil.getInt(params, SIZE))) {
|
||||||
params.put(CURRENT, 1);
|
params.put(CURRENT, 1);
|
||||||
params.put(SIZE, 20);
|
params.put(SIZE, 20);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
# 注册中心配置
|
# 注册中心配置
|
||||||
eureka:
|
eureka:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
|
|
|
@ -16,59 +16,39 @@
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.core.config;
|
package com.pig4cloud.pig.common.core.config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.pig4cloud.pig.common.core.jackson.PigJavaTimeModule;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.ZoneId;
|
||||||
import java.time.LocalDateTime;
|
import java.util.Locale;
|
||||||
import java.time.LocalTime;
|
import java.util.TimeZone;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JacksonConfig
|
* JacksonConfig
|
||||||
*
|
*
|
||||||
* @author: lengleng
|
* @author: lengleng
|
||||||
|
* @author L.cm
|
||||||
* @author: lishangbu
|
* @author: lishangbu
|
||||||
* @date: 2019/2/1
|
* @date: 2018/10/22
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(ObjectMapper.class)
|
@ConditionalOnClass(ObjectMapper.class)
|
||||||
@AutoConfigureBefore(JacksonAutoConfiguration.class)
|
@AutoConfigureBefore(JacksonAutoConfiguration.class)
|
||||||
public class JacksonConfig {
|
public class JacksonConfig {
|
||||||
/**
|
|
||||||
* 针对JDK 1.8的日期时间格式特殊处理
|
|
||||||
*
|
|
||||||
* @return ObjectMapper
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper getObjectMapper() {
|
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
return builder -> {
|
||||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
builder.locale(Locale.CHINA);
|
||||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
|
||||||
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
|
||||||
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
builder.modules(new PigJavaTimeModule());
|
||||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
};
|
||||||
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
||||||
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
|
||||||
// javaTimeModule只能手动注册,参考https://github.com/FasterXML/jackson-modules-java8
|
|
||||||
objectMapper.registerModule(javaTimeModule);
|
|
||||||
// 忽略json字符串中不识别的属性
|
|
||||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
// 忽略无法转换的对象
|
|
||||||
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
|
||||||
return objectMapper;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ package com.pig4cloud.pig.common.core.constant;
|
||||||
*/
|
*/
|
||||||
public interface ServiceNameConstants {
|
public interface ServiceNameConstants {
|
||||||
/**
|
/**
|
||||||
* 认证服务的SERVICEID(zuul 配置的对应)
|
* 认证服务的SERVICEID
|
||||||
*/
|
*/
|
||||||
String AUTH_SERVICE = "pig-auth";
|
String AUTH_SERVICE = "pig-auth";
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
|
import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.executor.statement.StatementHandler;
|
import org.apache.ibatis.executor.statement.StatementHandler;
|
||||||
import org.apache.ibatis.mapping.BoundSql;
|
import org.apache.ibatis.mapping.BoundSql;
|
||||||
|
@ -46,7 +47,8 @@ import java.util.Properties;
|
||||||
public class DataScopeInterceptor extends AbstractSqlParserHandler implements Interceptor {
|
public class DataScopeInterceptor extends AbstractSqlParserHandler implements Interceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object intercept(Invocation invocation) throws Throwable {
|
@SneakyThrows
|
||||||
|
public Object intercept(Invocation invocation) {
|
||||||
StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());
|
StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());
|
||||||
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
|
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
|
||||||
this.sqlParser(metaObject);
|
this.sqlParser(metaObject);
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
|
|
||||||
* <p>
|
|
||||||
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* <p>
|
|
||||||
* https://www.gnu.org/licenses/lgpl.html
|
|
||||||
* <p>
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.core.exception;
|
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lengleng
|
|
||||||
* @date 2018年06月22日16:22:10
|
|
||||||
*/
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class UnloginException extends RuntimeException {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public UnloginException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnloginException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnloginException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnloginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
|
||||||
|
* <p>
|
||||||
|
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* <p>
|
||||||
|
* https://www.gnu.org/licenses/lgpl.html
|
||||||
|
* <p>
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.pig4cloud.pig.common.core.jackson;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* java 8 时间默认序列化
|
||||||
|
*
|
||||||
|
* @author L.cm
|
||||||
|
* @author lishanbu
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PigJavaTimeModule extends SimpleModule {
|
||||||
|
|
||||||
|
public PigJavaTimeModule() {
|
||||||
|
super(PackageVersion.VERSION);
|
||||||
|
this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||||
|
this.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||||
|
this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
|
||||||
|
this.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||||
|
this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||||
|
this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.core.util;
|
package com.pig4cloud.pig.common.core.util;
|
||||||
|
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import org.springframework.core.BridgeMethodResolver;
|
import org.springframework.core.BridgeMethodResolver;
|
||||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
|
@ -33,8 +34,9 @@ import java.lang.reflect.Method;
|
||||||
*
|
*
|
||||||
* @author L.cm
|
* @author L.cm
|
||||||
*/
|
*/
|
||||||
|
@UtilityClass
|
||||||
public class ClassUtils extends org.springframework.util.ClassUtils {
|
public class ClassUtils extends org.springframework.util.ClassUtils {
|
||||||
private static final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
|
private final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取方法参数信息
|
* 获取方法参数信息
|
||||||
|
@ -43,7 +45,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
|
||||||
* @param parameterIndex 参数序号
|
* @param parameterIndex 参数序号
|
||||||
* @return {MethodParameter}
|
* @return {MethodParameter}
|
||||||
*/
|
*/
|
||||||
public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
|
public MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
|
||||||
MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
|
MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
|
||||||
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
|
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
|
||||||
return methodParameter;
|
return methodParameter;
|
||||||
|
@ -56,7 +58,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
|
||||||
* @param parameterIndex 参数序号
|
* @param parameterIndex 参数序号
|
||||||
* @return {MethodParameter}
|
* @return {MethodParameter}
|
||||||
*/
|
*/
|
||||||
public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
|
public MethodParameter getMethodParameter(Method method, int parameterIndex) {
|
||||||
MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
|
MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
|
||||||
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
|
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
|
||||||
return methodParameter;
|
return methodParameter;
|
||||||
|
@ -70,7 +72,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
|
||||||
* @param <A> 泛型标记
|
* @param <A> 泛型标记
|
||||||
* @return {Annotation}
|
* @return {Annotation}
|
||||||
*/
|
*/
|
||||||
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
|
public <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
|
||||||
Class<?> targetClass = method.getDeclaringClass();
|
Class<?> targetClass = method.getDeclaringClass();
|
||||||
// The method may be on an interface, but we need attributes from the target class.
|
// The method may be on an interface, but we need attributes from the target class.
|
||||||
// If the target class is null, the method will be unchanged.
|
// If the target class is null, the method will be unchanged.
|
||||||
|
@ -95,7 +97,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
|
||||||
* @param <A> 泛型标记
|
* @param <A> 泛型标记
|
||||||
* @return {Annotation}
|
* @return {Annotation}
|
||||||
*/
|
*/
|
||||||
public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
|
public <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
|
||||||
// 先找方法,再找方法上的类
|
// 先找方法,再找方法上的类
|
||||||
A annotation = handlerMethod.getMethodAnnotation(annotationType);
|
A annotation = handlerMethod.getMethodAnnotation(annotationType);
|
||||||
if (null != annotation) {
|
if (null != annotation) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.core.util;
|
package com.pig4cloud.pig.common.core.util;
|
||||||
|
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
@ -92,7 +93,8 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
|
||||||
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
|
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void destroy() throws Exception {
|
@SneakyThrows
|
||||||
|
public void destroy() {
|
||||||
SpringContextHolder.clearHolder();
|
SpringContextHolder.clearHolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import cn.hutool.core.codec.Base64;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.pig4cloud.pig.common.core.exception.CheckedException;
|
import com.pig4cloud.pig.common.core.exception.CheckedException;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
@ -45,9 +46,10 @@ import java.nio.charset.StandardCharsets;
|
||||||
* @author L.cm
|
* @author L.cm
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@UtilityClass
|
||||||
public class WebUtils extends org.springframework.web.util.WebUtils {
|
public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
private static final String BASIC_ = "Basic ";
|
private final String BASIC_ = "Basic ";
|
||||||
private static final String UNKNOWN = "unknown";
|
private final String UNKNOWN = "unknown";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否ajax请求
|
* 判断是否ajax请求
|
||||||
|
@ -56,7 +58,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param handlerMethod HandlerMethod
|
* @param handlerMethod HandlerMethod
|
||||||
* @return 是否ajax请求
|
* @return 是否ajax请求
|
||||||
*/
|
*/
|
||||||
public static boolean isBody(HandlerMethod handlerMethod) {
|
public boolean isBody(HandlerMethod handlerMethod) {
|
||||||
ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
|
ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
|
||||||
return responseBody != null;
|
return responseBody != null;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +69,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param name cookie name
|
* @param name cookie name
|
||||||
* @return cookie value
|
* @return cookie value
|
||||||
*/
|
*/
|
||||||
public static String getCookieVal(String name) {
|
public String getCookieVal(String name) {
|
||||||
HttpServletRequest request = WebUtils.getRequest();
|
HttpServletRequest request = WebUtils.getRequest();
|
||||||
Assert.notNull(request, "request from RequestContextHolder is null");
|
Assert.notNull(request, "request from RequestContextHolder is null");
|
||||||
return getCookieVal(request, name);
|
return getCookieVal(request, name);
|
||||||
|
@ -80,7 +82,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param name cookie name
|
* @param name cookie name
|
||||||
* @return cookie value
|
* @return cookie value
|
||||||
*/
|
*/
|
||||||
public static String getCookieVal(HttpServletRequest request, String name) {
|
public String getCookieVal(HttpServletRequest request, String name) {
|
||||||
Cookie cookie = getCookie(request, name);
|
Cookie cookie = getCookie(request, name);
|
||||||
return cookie != null ? cookie.getValue() : null;
|
return cookie != null ? cookie.getValue() : null;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
* @param key cookie key
|
* @param key cookie key
|
||||||
*/
|
*/
|
||||||
public static void removeCookie(HttpServletResponse response, String key) {
|
public void removeCookie(HttpServletResponse response, String key) {
|
||||||
setCookie(response, key, null, 0);
|
setCookie(response, key, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +105,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param value cookie value
|
* @param value cookie value
|
||||||
* @param maxAgeInSeconds maxage
|
* @param maxAgeInSeconds maxage
|
||||||
*/
|
*/
|
||||||
public static void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
|
public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
|
||||||
Cookie cookie = new Cookie(name, value);
|
Cookie cookie = new Cookie(name, value);
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
cookie.setMaxAge(maxAgeInSeconds);
|
cookie.setMaxAge(maxAgeInSeconds);
|
||||||
|
@ -116,7 +118,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
*
|
*
|
||||||
* @return {HttpServletRequest}
|
* @return {HttpServletRequest}
|
||||||
*/
|
*/
|
||||||
public static HttpServletRequest getRequest() {
|
public HttpServletRequest getRequest() {
|
||||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +127,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
*
|
*
|
||||||
* @return {HttpServletResponse}
|
* @return {HttpServletResponse}
|
||||||
*/
|
*/
|
||||||
public static HttpServletResponse getResponse() {
|
public HttpServletResponse getResponse() {
|
||||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
* @param result 结果对象
|
* @param result 结果对象
|
||||||
*/
|
*/
|
||||||
public static void renderJson(HttpServletResponse response, Object result) {
|
public void renderJson(HttpServletResponse response, Object result) {
|
||||||
renderJson(response, result, MediaType.APPLICATION_JSON_UTF8_VALUE);
|
renderJson(response, result, MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +148,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param result 结果对象
|
* @param result 结果对象
|
||||||
* @param contentType contentType
|
* @param contentType contentType
|
||||||
*/
|
*/
|
||||||
public static void renderJson(HttpServletResponse response, Object result, String contentType) {
|
public void renderJson(HttpServletResponse response, Object result, String contentType) {
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
try (PrintWriter out = response.getWriter()) {
|
try (PrintWriter out = response.getWriter()) {
|
||||||
|
@ -161,7 +163,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
*
|
*
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
public static String getIP() {
|
public String getIP() {
|
||||||
return getIP(WebUtils.getRequest());
|
return getIP(WebUtils.getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +173,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @param request HttpServletRequest
|
* @param request HttpServletRequest
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
public static String getIP(HttpServletRequest request) {
|
public String getIP(HttpServletRequest request) {
|
||||||
Assert.notNull(request, "HttpServletRequest is null");
|
Assert.notNull(request, "HttpServletRequest is null");
|
||||||
String ip = request.getHeader("X-Requested-For");
|
String ip = request.getHeader("X-Requested-For");
|
||||||
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
|
if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
|
||||||
|
@ -201,7 +203,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static String[] getClientId(ServerHttpRequest request) {
|
public String[] getClientId(ServerHttpRequest request) {
|
||||||
String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
|
String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
|
||||||
|
|
||||||
if (header == null || !header.startsWith(BASIC_)) {
|
if (header == null || !header.startsWith(BASIC_)) {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-log</artifactId>
|
<artifactId>pig-common-log</artifactId>
|
||||||
|
@ -35,13 +35,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--UPMS接口模块-->
|
<!--UPMS接口模块-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--安全依赖获取上下文信息-->
|
<!--安全依赖获取上下文信息-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.pig4cloud.pig.common.core.util.SpringContextHolder;
|
||||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||||
import com.pig4cloud.pig.common.log.event.SysLogEvent;
|
import com.pig4cloud.pig.common.log.event.SysLogEvent;
|
||||||
import com.pig4cloud.pig.common.log.util.SysLogUtils;
|
import com.pig4cloud.pig.common.log.util.SysLogUtils;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
@ -35,7 +36,8 @@ import org.aspectj.lang.annotation.Aspect;
|
||||||
public class SysLogAspect {
|
public class SysLogAspect {
|
||||||
|
|
||||||
@Around("@annotation(sysLog)")
|
@Around("@annotation(sysLog)")
|
||||||
public Object around(ProceedingJoinPoint point, SysLog sysLog) throws Throwable {
|
@SneakyThrows
|
||||||
|
public Object around(ProceedingJoinPoint point, SysLog sysLog) {
|
||||||
String strClassName = point.getTarget().getClass().getName();
|
String strClassName = point.getTarget().getClass().getName();
|
||||||
String strMethodName = point.getSignature().getName();
|
String strMethodName = point.getSignature().getName();
|
||||||
log.debug("[类名]:{},[方法]:{}", strClassName, strMethodName);
|
log.debug("[类名]:{},[方法]:{}", strClassName, strMethodName);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
||||||
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||||
|
@ -35,8 +36,9 @@ import java.util.Objects;
|
||||||
*
|
*
|
||||||
* @author L.cm
|
* @author L.cm
|
||||||
*/
|
*/
|
||||||
|
@UtilityClass
|
||||||
public class SysLogUtils {
|
public class SysLogUtils {
|
||||||
public static SysLog getSysLog() {
|
public SysLog getSysLog() {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) Objects
|
HttpServletRequest request = ((ServletRequestAttributes) Objects
|
||||||
.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||||
SysLog sysLog = new SysLog();
|
SysLog sysLog = new SysLog();
|
||||||
|
@ -56,7 +58,7 @@ public class SysLogUtils {
|
||||||
*
|
*
|
||||||
* @return clientId
|
* @return clientId
|
||||||
*/
|
*/
|
||||||
private static String getClientId() {
|
private String getClientId() {
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (authentication instanceof OAuth2Authentication) {
|
if (authentication instanceof OAuth2Authentication) {
|
||||||
OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
|
OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
|
||||||
|
@ -70,7 +72,7 @@ public class SysLogUtils {
|
||||||
*
|
*
|
||||||
* @return username
|
* @return username
|
||||||
*/
|
*/
|
||||||
private static String getUsername() {
|
private String getUsername() {
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (authentication == null) {
|
if (authentication == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common-security</artifactId>
|
<artifactId>pig-common-security</artifactId>
|
||||||
|
@ -35,18 +35,22 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--安全模块-->
|
<!--安全模块-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-security</artifactId>
|
<artifactId>spring-cloud-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||||
|
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--UPMS API-->
|
<!--UPMS API-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -27,15 +27,14 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
import com.pig4cloud.pig.common.core.exception.PigDeniedException;
|
import com.pig4cloud.pig.common.core.exception.PigDeniedException;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
|
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,11 +54,10 @@ public class PigAccessDeniedHandler extends OAuth2AccessDeniedHandler {
|
||||||
* @param request request
|
* @param request request
|
||||||
* @param response response
|
* @param response response
|
||||||
* @param authException authException
|
* @param authException authException
|
||||||
* @throws IOException IOException
|
|
||||||
* @throws ServletException ServletException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException authException) throws IOException, ServletException {
|
@SneakyThrows
|
||||||
|
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException authException) {
|
||||||
log.info("授权失败,禁止访问 {}", request.getRequestURI());
|
log.info("授权失败,禁止访问 {}", request.getRequestURI());
|
||||||
response.setCharacterEncoding(CommonConstants.UTF8);
|
response.setCharacterEncoding(CommonConstants.UTF8);
|
||||||
response.setContentType(CommonConstants.CONTENT_TYPE);
|
response.setContentType(CommonConstants.CONTENT_TYPE);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.security.component;
|
package com.pig4cloud.pig.common.security.component;
|
||||||
|
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
@ -25,8 +26,6 @@ import org.springframework.http.client.ClientHttpResponse;
|
||||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
* @date 2019/03/08
|
* @date 2019/03/08
|
||||||
|
@ -40,7 +39,8 @@ public class PigResourceServerAutoConfiguration {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
|
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleError(ClientHttpResponse response) throws IOException {
|
@SneakyThrows
|
||||||
|
public void handleError(ClientHttpResponse response) {
|
||||||
if (response.getRawStatusCode() != HttpStatus.BAD_REQUEST.value()) {
|
if (response.getRawStatusCode() != HttpStatus.BAD_REQUEST.value()) {
|
||||||
super.handleError(response);
|
super.handleError(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.pig4cloud.pig.common.security.component;
|
package com.pig4cloud.pig.common.security.component;
|
||||||
|
|
||||||
import com.pig4cloud.pig.common.security.exception.*;
|
import com.pig4cloud.pig.common.security.exception.*;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -44,7 +45,8 @@ public class PigWebResponseExceptionTranslator implements WebResponseExceptionTr
|
||||||
private ThrowableAnalyzer throwableAnalyzer = new DefaultThrowableAnalyzer();
|
private ThrowableAnalyzer throwableAnalyzer = new DefaultThrowableAnalyzer();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<OAuth2Exception> translate(Exception e) throws Exception {
|
@SneakyThrows
|
||||||
|
public ResponseEntity<OAuth2Exception> translate(Exception e) {
|
||||||
|
|
||||||
// Try to extract a SpringSecurityException from the stacktrace
|
// Try to extract a SpringSecurityException from the stacktrace
|
||||||
Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e);
|
Throwable[] causeChain = throwableAnalyzer.determineCauseChain(e);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
@ -28,7 +29,6 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +44,9 @@ public class ResourceAuthExceptionEntryPoint implements AuthenticationEntryPoint
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SneakyThrows
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response,
|
public void commence(HttpServletRequest request, HttpServletResponse response,
|
||||||
AuthenticationException authException) throws IOException {
|
AuthenticationException authException) {
|
||||||
response.setCharacterEncoding(CommonConstants.UTF8);
|
response.setCharacterEncoding(CommonConstants.UTF8);
|
||||||
response.setContentType(CommonConstants.CONTENT_TYPE);
|
response.setContentType(CommonConstants.CONTENT_TYPE);
|
||||||
R<String> result = new R<>();
|
R<String> result = new R<>();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.pig4cloud.pig.common.security.service;
|
package com.pig4cloud.pig.common.security.service;
|
||||||
|
|
||||||
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
|
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
|
||||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||||
|
@ -41,11 +42,11 @@ public class PigClientDetailsService extends JdbcClientDetailsService {
|
||||||
*
|
*
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @return
|
* @return
|
||||||
* @throws InvalidClientException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SneakyThrows
|
||||||
@Cacheable(value = SecurityConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
|
@Cacheable(value = SecurityConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
|
||||||
public ClientDetails loadClientByClientId(String clientId) throws InvalidClientException {
|
public ClientDetails loadClientByClientId(String clientId) {
|
||||||
return super.loadClientByClientId(clientId);
|
return super.loadClientByClientId(clientId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
|
@ -57,10 +58,10 @@ public class PigUserDetailsServiceImpl implements UserDetailsService {
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return
|
* @return
|
||||||
* @throws UsernameNotFoundException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
@SneakyThrows
|
||||||
|
public UserDetails loadUserByUsername(String username) {
|
||||||
Cache cache = cacheManager.getCache("user_details");
|
Cache cache = cacheManager.getCache("user_details");
|
||||||
if (cache != null && cache.get(username) != null) {
|
if (cache != null && cache.get(username) != null) {
|
||||||
return (PigUser) cache.get(username).get();
|
return (PigUser) cache.get(username).get();
|
||||||
|
|
|
@ -18,6 +18,8 @@ package com.pig4cloud.pig.common.security.util;
|
||||||
|
|
||||||
import cn.hutool.core.codec.Base64;
|
import cn.hutool.core.codec.Base64;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
|
@ -30,18 +32,17 @@ import java.io.IOException;
|
||||||
* 认证授权相关工具类
|
* 认证授权相关工具类
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@UtilityClass
|
||||||
public class AuthUtils {
|
public class AuthUtils {
|
||||||
private static final String BASIC_ = "Basic ";
|
private final String BASIC_ = "Basic ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从header 请求中的clientId/clientsecect
|
* 从header 请求中的clientId/clientsecect
|
||||||
*
|
*
|
||||||
* @param header header中的参数
|
* @param header header中的参数
|
||||||
* @throws RuntimeException if the Basic header is not present or is not valid
|
|
||||||
* Base64
|
|
||||||
*/
|
*/
|
||||||
public static String[] extractAndDecodeHeader(String header)
|
@SneakyThrows
|
||||||
throws IOException {
|
public String[] extractAndDecodeHeader(String header) {
|
||||||
|
|
||||||
byte[] base64Token = header.substring(6).getBytes("UTF-8");
|
byte[] base64Token = header.substring(6).getBytes("UTF-8");
|
||||||
byte[] decoded;
|
byte[] decoded;
|
||||||
|
@ -67,10 +68,9 @@ public class AuthUtils {
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public static String[] extractAndDecodeHeader(HttpServletRequest request)
|
@SneakyThrows
|
||||||
throws IOException {
|
public String[] extractAndDecodeHeader(HttpServletRequest request) {
|
||||||
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
|
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
|
||||||
|
|
||||||
if (header == null || !header.startsWith(BASIC_)) {
|
if (header == null || !header.startsWith(BASIC_)) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SecurityUtils {
|
||||||
/**
|
/**
|
||||||
* 获取Authentication
|
* 获取Authentication
|
||||||
*/
|
*/
|
||||||
public static Authentication getAuthentication() {
|
public Authentication getAuthentication() {
|
||||||
return SecurityContextHolder.getContext().getAuthentication();
|
return SecurityContextHolder.getContext().getAuthentication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-common</artifactId>
|
<artifactId>pig-common</artifactId>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-config</artifactId>
|
<artifactId>pig-config</artifactId>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
|
|
|
@ -10,7 +10,7 @@ security:
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
|
|
|
@ -9,7 +9,7 @@ security:
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
|
|
|
@ -2,7 +2,7 @@ spring:
|
||||||
# 数据源
|
# 数据源
|
||||||
datasource:
|
datasource:
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-eureka</artifactId>
|
<artifactId>pig-eureka</artifactId>
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.pig4cloud.pig.eureka.security;
|
||||||
* @date 2019/2/1
|
* @date 2019/2/1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
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.EnableWebSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
@ -28,7 +29,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
@SneakyThrows
|
||||||
|
protected void configure(HttpSecurity http) {
|
||||||
http.csrf().disable()
|
http.csrf().disable()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers("/actuator/**").permitAll()
|
.antMatchers("/actuator/**").permitAll()
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-gateway</artifactId>
|
<artifactId>pig-gateway</artifactId>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ spring:
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
# 注册中心
|
# 注册中心
|
||||||
eureka:
|
eureka:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms-biz</artifactId>
|
<artifactId>pig-upms-biz</artifactId>
|
||||||
|
@ -34,19 +34,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-upms-api</artifactId>
|
<artifactId>pig-upms-api</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--安全模块-->
|
<!--安全模块-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-security</artifactId>
|
<artifactId>pig-common-security</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--日志处理-->
|
<!--日志处理-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-log</artifactId>
|
<artifactId>pig-common-log</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--配置中心客户端-->
|
<!--配置中心客户端-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -15,6 +15,8 @@ spring:
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
# 注册中心配置
|
# 注册中心配置
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-upms</artifactId>
|
<artifactId>pig-upms</artifactId>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-codegen</artifactId>
|
<artifactId>pig-codegen</artifactId>
|
||||||
|
@ -50,13 +50,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-core</artifactId>
|
<artifactId>pig-common-core</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--安全模块-->
|
<!--安全模块-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-common-security</artifactId>
|
<artifactId>pig-common-security</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--代码生成模板引擎-->
|
<!--代码生成模板引擎-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.pig4cloud.pig.codegen.entity.GenConfig;
|
||||||
import com.pig4cloud.pig.codegen.service.SysGeneratorService;
|
import com.pig4cloud.pig.codegen.service.SysGeneratorService;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -55,7 +56,8 @@ public class SysGeneratorController {
|
||||||
* 生成代码
|
* 生成代码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/code")
|
@PostMapping("/code")
|
||||||
public void code(@RequestBody GenConfig genConfig, HttpServletResponse response) throws IOException {
|
@SneakyThrows
|
||||||
|
public void code(@RequestBody GenConfig genConfig, HttpServletResponse response) {
|
||||||
byte[] data = sysGeneratorService.generatorCode(genConfig);
|
byte[] data = sysGeneratorService.generatorCode(genConfig);
|
||||||
|
|
||||||
response.reset();
|
response.reset();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.pig4cloud.pig.codegen.entity.GenConfig;
|
||||||
import com.pig4cloud.pig.codegen.entity.TableEntity;
|
import com.pig4cloud.pig.codegen.entity.TableEntity;
|
||||||
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||||
import com.pig4cloud.pig.common.core.exception.CheckedException;
|
import com.pig4cloud.pig.common.core.exception.CheckedException;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.configuration.Configuration;
|
import org.apache.commons.configuration.Configuration;
|
||||||
import org.apache.commons.configuration.ConfigurationException;
|
import org.apache.commons.configuration.ConfigurationException;
|
||||||
|
@ -49,6 +50,7 @@ import java.util.zip.ZipOutputStream;
|
||||||
* @date 2019/2/1
|
* @date 2019/2/1
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@UtilityClass
|
||||||
public class GenUtils {
|
public class GenUtils {
|
||||||
|
|
||||||
private static final String ENTITY_JAVA_VM = "Entity.java.vm";
|
private static final String ENTITY_JAVA_VM = "Entity.java.vm";
|
||||||
|
@ -62,7 +64,7 @@ public class GenUtils {
|
||||||
private static final String API_JS_VM = "api.js.vm";
|
private static final String API_JS_VM = "api.js.vm";
|
||||||
private static final String CRUD_JS_VM = "crud.js.vm";
|
private static final String CRUD_JS_VM = "crud.js.vm";
|
||||||
|
|
||||||
private static List<String> getTemplates() {
|
private List<String> getTemplates() {
|
||||||
List<String> templates = new ArrayList<>();
|
List<String> templates = new ArrayList<>();
|
||||||
templates.add("template/Entity.java.vm");
|
templates.add("template/Entity.java.vm");
|
||||||
templates.add("template/Mapper.java.vm");
|
templates.add("template/Mapper.java.vm");
|
||||||
|
@ -81,7 +83,7 @@ public class GenUtils {
|
||||||
/**
|
/**
|
||||||
* 生成代码
|
* 生成代码
|
||||||
*/
|
*/
|
||||||
public static void generatorCode(GenConfig genConfig, Map<String, String> table,
|
public void generatorCode(GenConfig genConfig, Map<String, String> table,
|
||||||
List<Map<String, String>> columns, ZipOutputStream zip) {
|
List<Map<String, String>> columns, ZipOutputStream zip) {
|
||||||
//配置信息
|
//配置信息
|
||||||
Configuration config = getConfig();
|
Configuration config = getConfig();
|
||||||
|
@ -210,14 +212,14 @@ public class GenUtils {
|
||||||
/**
|
/**
|
||||||
* 列名转换成Java属性名
|
* 列名转换成Java属性名
|
||||||
*/
|
*/
|
||||||
private static String columnToJava(String columnName) {
|
private String columnToJava(String columnName) {
|
||||||
return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
|
return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表名转换成Java类名
|
* 表名转换成Java类名
|
||||||
*/
|
*/
|
||||||
private static String tableToJava(String tableName, String tablePrefix) {
|
private String tableToJava(String tableName, String tablePrefix) {
|
||||||
if (StringUtils.isNotBlank(tablePrefix)) {
|
if (StringUtils.isNotBlank(tablePrefix)) {
|
||||||
tableName = tableName.replace(tablePrefix, "");
|
tableName = tableName.replace(tablePrefix, "");
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ public class GenUtils {
|
||||||
/**
|
/**
|
||||||
* 获取配置信息
|
* 获取配置信息
|
||||||
*/
|
*/
|
||||||
private static Configuration getConfig() {
|
private Configuration getConfig() {
|
||||||
try {
|
try {
|
||||||
return new PropertiesConfiguration("generator.properties");
|
return new PropertiesConfiguration("generator.properties");
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
|
@ -238,7 +240,7 @@ public class GenUtils {
|
||||||
/**
|
/**
|
||||||
* 获取文件名
|
* 获取文件名
|
||||||
*/
|
*/
|
||||||
private static String getFileName(String template, String className, String packageName, String moduleName) {
|
private String getFileName(String template, String className, String packageName, String moduleName) {
|
||||||
String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator;
|
String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator;
|
||||||
if (StringUtils.isNotBlank(packageName)) {
|
if (StringUtils.isNotBlank(packageName)) {
|
||||||
packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;
|
packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;
|
||||||
|
|
|
@ -15,7 +15,8 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
# 注册中心配置
|
# 注册中心配置
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-monitor</artifactId>
|
<artifactId>pig-monitor</artifactId>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package com.pig4cloud.pig.monitor.config;
|
package com.pig4cloud.pig.monitor.config;
|
||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
@ -37,7 +38,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
@SneakyThrows
|
||||||
|
protected void configure(HttpSecurity http) {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
||||||
successHandler.setTargetUrlParameter("redirectTo");
|
successHandler.setTargetUrlParameter("redirectTo");
|
||||||
|
|
|
@ -15,7 +15,8 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
# 注册中心配置
|
# 注册中心配置
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-id: pig-config
|
service-id: pig-config
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
# 注册中心配置
|
# 注册中心配置
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pig-visual</artifactId>
|
<artifactId>pig-visual</artifactId>
|
||||||
|
|
22
pom.xml
22
pom.xml
|
@ -21,25 +21,26 @@
|
||||||
|
|
||||||
<groupId>com.pig4cloud</groupId>
|
<groupId>com.pig4cloud</groupId>
|
||||||
<artifactId>pig</artifactId>
|
<artifactId>pig</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0</version>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<url>https://www.pig4cloud.com</url>
|
<url>https://www.pig4cloud.com</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-boot.version>2.0.8.RELEASE</spring-boot.version>
|
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
|
||||||
<spring-cloud.version>Finchley.SR3</spring-cloud.version>
|
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
|
||||||
<spring-platform.version>Cairo-SR7</spring-platform.version>
|
<spring-platform.version>Cairo-SR7</spring-platform.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<spring-boot-admin.version>2.0.5</spring-boot-admin.version>
|
<spring-boot-admin.version>2.1.3</spring-boot-admin.version>
|
||||||
<hutool.version>4.5.0</hutool.version>
|
<hutool.version>4.5.0</hutool.version>
|
||||||
<mybatis-plus.version>3.1.0</mybatis-plus.version>
|
<mybatis-plus.version>3.1.0</mybatis-plus.version>
|
||||||
<kaptcha.version>0.0.9</kaptcha.version>
|
<kaptcha.version>0.0.9</kaptcha.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
<jasypt.version>2.1.0</jasypt.version>
|
<jasypt.version>2.1.0</jasypt.version>
|
||||||
<security.oauth.version>2.3.3.RELEASE</security.oauth.version>
|
<security.oauth.version>2.3.5.RELEASE</security.oauth.version>
|
||||||
|
<security.oauth.auto.version>2.1.2.RELEASE</security.oauth.auto.version>
|
||||||
<jackson.modules>2.9.8</jackson.modules>
|
<jackson.modules>2.9.8</jackson.modules>
|
||||||
<!--zipkin2.12.x需要此版本jooq-->
|
<!--zipkin2.12.x需要此版本jooq-->
|
||||||
<jooq.version>3.11.9</jooq.version>
|
<jooq.version>3.11.9</jooq.version>
|
||||||
|
@ -138,6 +139,17 @@
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--稳定版本,替代spring security bom内置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security.oauth</groupId>
|
||||||
|
<artifactId>spring-security-oauth2</artifactId>
|
||||||
|
<version>${security.oauth.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||||
|
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||||
|
<version>${security.oauth.auto.version}</version>
|
||||||
|
</dependency>
|
||||||
<!--jackson模块-->
|
<!--jackson模块-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.module</groupId>
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
|
Loading…
Reference in New Issue