🔖 Releasing / Version tags. 2.7.1

This commit is contained in:
冷冷 2020-03-30 22:13:53 +08:00
parent 5a35db4960
commit e151016525
19 changed files with 116 additions and 125 deletions

View File

@ -1,4 +1,7 @@
[pigx 相关问题请去此提,码云忽略](https://git.pig4cloud.com/pig/pigx/issues)
### 版本信息 ### 版本信息
- pig版本: - pig版本:
- 是否修改包名: - 是否修改包名:

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-auth</artifactId> <artifactId>pig-auth</artifactId>
@ -46,13 +46,13 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId> <artifactId>pig-upms-api</artifactId>
<version>2.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--JDBC相关--> <!--JDBC相关-->
<dependency> <dependency>

View File

@ -24,7 +24,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-codegen</artifactId> <artifactId>pig-codegen</artifactId>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-swagger</artifactId> <artifactId>pig-common-swagger</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--注册中心客户端--> <!--注册中心客户端-->
<dependency> <dependency>
@ -53,30 +53,30 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-datasource</artifactId> <artifactId>pig-common-datasource</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-mybatis</artifactId> <artifactId>pig-common-mybatis</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--common--> <!--common-->
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>
<version>2.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--代码生成模板引擎--> <!--代码生成模板引擎-->
<dependency> <dependency>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common-log</artifactId> <artifactId>pig-common-log</artifactId>
@ -37,13 +37,13 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>
<version>2.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--安全依赖获取上下文信息--> <!--安全依赖获取上下文信息-->
<dependency> <dependency>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common-mybatis</artifactId> <artifactId>pig-common-mybatis</artifactId>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common-security</artifactId> <artifactId>pig-common-security</artifactId>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--安全模块--> <!--安全模块-->
<dependency> <dependency>
@ -52,7 +52,7 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId> <artifactId>pig-upms-api</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common-swagger</artifactId> <artifactId>pig-common-swagger</artifactId>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-common</artifactId> <artifactId>pig-common</artifactId>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-gateway</artifactId> <artifactId>pig-gateway</artifactId>
@ -61,7 +61,7 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--接口文档--> <!--接口文档-->
<dependency> <dependency>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-monitor</artifactId> <artifactId>pig-monitor</artifactId>

View File

@ -24,7 +24,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-register</artifactId> <artifactId>pig-register</artifactId>

View File

@ -75,9 +75,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
public void configure(WebSecurity web) { public void configure(WebSecurity web) {
String ignoreURLs = env.getProperty("nacos.security.ignore.urls", "/**"); String ignoreUrls = env.getProperty("nacos.security.ignore.urls", "/**");
for (String ignoreURL : ignoreURLs.trim().split(SECURITY_IGNORE_URLS_SPILT_CHAR)) { for (String url : ignoreUrls.trim().split(SECURITY_IGNORE_URLS_SPILT_CHAR)) {
web.ignoring().antMatchers(ignoreURL.trim()); web.ignoring().antMatchers(url.trim());
} }
} }

View File

@ -38,102 +38,90 @@ import java.util.List;
@Component @Component
public class JwtTokenUtils { public class JwtTokenUtils {
private final Logger log = LoggerFactory.getLogger(JwtTokenUtils.class); private final Logger log = LoggerFactory.getLogger(JwtTokenUtils.class);
private static final String AUTHORITIES_KEY = "auth"; private static final String AUTHORITIES_KEY = "auth";
/** /**
* secret key * secret key
*/ */
private String secretKey; private String secretKey;
/** /**
* Token validity time(ms) * Token validity time(ms)
*/ */
private long tokenValidityInMilliseconds; private long tokenValidityInMilliseconds;
@PostConstruct @PostConstruct
public void init() { public void init() {
this.secretKey = "SecretKey012345678901234567890123456789012345678901234567890123456789"; this.secretKey = "SecretKey012345678901234567890123456789012345678901234567890123456789";
this.tokenValidityInMilliseconds = 1000 * 60 * 30L; this.tokenValidityInMilliseconds = 1000 * 60 * 30L;
} }
/** /**
* Create token * Create token
* *
* @param authentication auth info * @param authentication auth info
* @return token * @return token
*/ */
public String createToken(Authentication authentication) { public String createToken(Authentication authentication) {
/** /**
* Current time * Current time
*/ */
long now = (new Date()).getTime(); long now = (new Date()).getTime();
/** /**
* Validity date * Validity date
*/ */
Date validity; Date validity;
validity = new Date(now + this.tokenValidityInMilliseconds); validity = new Date(now + this.tokenValidityInMilliseconds);
/** /**
* create token * create token
*/ */
return Jwts.builder() return Jwts.builder()
.setSubject(authentication.getName()) .setSubject(authentication.getName())
.claim(AUTHORITIES_KEY, "") .claim(AUTHORITIES_KEY, "")
.setExpiration(validity) .setExpiration(validity)
.signWith(SignatureAlgorithm.HS256, secretKey) .signWith(SignatureAlgorithm.HS256, secretKey)
.compact(); .compact();
} }
/** /**
* Get auth Info * Get auth Info
* *
* @param token token * @param token token
* @return auth info * @return auth info
*/ */
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
/** /**
* parse the payload of token * parse the payload of token
*/ */
Claims claims = Jwts.parser() Claims claims = Jwts.parser()
.setSigningKey(secretKey) .setSigningKey(secretKey)
.parseClaimsJws(token) .parseClaimsJws(token)
.getBody(); .getBody();
List<GrantedAuthority> authorities = AuthorityUtils.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY)); List<GrantedAuthority> authorities = AuthorityUtils.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY));
User principal = new User(claims.getSubject(), "", authorities); User principal = new User(claims.getSubject(), "", authorities);
return new UsernamePasswordAuthenticationToken(principal, "", authorities); return new UsernamePasswordAuthenticationToken(principal, "", authorities);
} }
/** /**
* validate token * validate token
* *
* @param token token * @param token token
* @return whether valid * @return whether valid
*/ */
public boolean validateToken(String token) { public boolean validateToken(String token) {
try { try {
Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token); Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token);
return true; return true;
} catch (SignatureException e) { } catch (Exception e) {
log.info("Invalid JWT signature."); log.info("Invalid JWT signature.");
log.trace("Invalid JWT signature trace: {}", e); log.trace("Invalid JWT signature trace: {}", e);
} catch (MalformedJwtException e) { }
log.info("Invalid JWT token."); return false;
log.trace("Invalid JWT token trace: {}", e); }
} catch (ExpiredJwtException e) {
log.info("Expired JWT token.");
log.trace("Expired JWT token trace: {}", e);
} catch (UnsupportedJwtException e) {
log.info("Unsupported JWT token.");
log.trace("Unsupported JWT token trace: {}", e);
} catch (IllegalArgumentException e) {
log.info("JWT token compact of handler are invalid.");
log.trace("JWT token compact of handler are invalid trace: {}", e);
}
return false;
}
} }

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId> <artifactId>pig-upms</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-upms-api</artifactId> <artifactId>pig-upms-api</artifactId>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId> <artifactId>pig-common-core</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId> <artifactId>pig-upms</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-upms-biz</artifactId> <artifactId>pig-upms-biz</artifactId>
@ -36,31 +36,31 @@
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId> <artifactId>pig-upms-api</artifactId>
<version>2.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</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.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--接口文档--> <!--接口文档-->
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-swagger</artifactId> <artifactId>pig-common-swagger</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--mybatis 模块--> <!--mybatis 模块-->
<dependency> <dependency>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig-common-mybatis</artifactId> <artifactId>pig-common-mybatis</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<!--注册中心客户端--> <!--注册中心客户端-->
<dependency> <dependency>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</parent> </parent>
<artifactId>pig-upms</artifactId> <artifactId>pig-upms</artifactId>

View File

@ -29,7 +29,7 @@
<groupId>com.pig4cloud</groupId> <groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId> <artifactId>pig</artifactId>
<version>2.7.0</version> <version>2.7.1</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>