Skip to content

Commit

Permalink
Merge pull request #4 from buession/2.1.x
Browse files Browse the repository at this point in the history
release 2.1.1
  • Loading branch information
eduosi authored Aug 18, 2022
2 parents 23ec5db + bac8bba commit 68d2a91
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 59 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Buession SpringBoot Changelog
===========================


## [2.1.1](https://github.com/buession/buession-parent/releases/tag/v2.1.1) (2022-08-18)

### 🔨依赖升级

- [依赖库版本升级和安全漏洞修复](https://github.com/buession/buession-parent/releases/tag/v2.1.1)


### 🔔 变化

- **buession-springboot-shiro:** 配置 spring.shiro.session.session-id-url-rewriting-enabled 默认值改为 false


### 🐞 Bug 修复

- **buession-springboot-shiro:** 修复 spring.shiro.session、spring.shiro.remember-me 配置不生效的 BUG


---


## [2.1.0](https://github.com/buession/buession-springboot/releases/tag/v2.1.0) (2022-08-08)

### 🔨依赖升级
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-boot</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-cache</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-captcha</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-cli</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-datasource/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-datasource</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.buession.springboot.datasource.autoconfigure;

import com.buession.jdbc.datasource.config.AbstractPoolConfiguration;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;

Expand All @@ -37,6 +38,13 @@ protected static <T extends javax.sql.DataSource> T createDataSource(final DataS
final Class<T> type){
return properties.initializeDataSourceBuilder().type(type).build();
}

protected static void clearConfiguration(final AbstractPoolConfiguration configuration){
configuration.setUrl(null);
configuration.setDriverClassName(null);
configuration.setUsername(null);
configuration.setPassword(null);
}

public final static class HikariDataSource extends com.buession.jdbc.datasource.HikariDataSource {

Expand All @@ -52,11 +60,7 @@ public com.zaxxer.hikari.HikariDataSource createDataSource(){
final com.zaxxer.hikari.HikariDataSource dataSource = BaseDataSource.createDataSource(properties,
com.zaxxer.hikari.HikariDataSource.class);

getPoolConfiguration().setUrl(null);
getPoolConfiguration().setDriverClassName(null);
getPoolConfiguration().setUsername(null);
getPoolConfiguration().setPassword(null);

clearConfiguration(getPoolConfiguration());
applyPoolConfiguration(dataSource, getPoolConfiguration());

return dataSource;
Expand All @@ -78,11 +82,7 @@ public BasicDataSource createDataSource(){
final BasicDataSource dataSource = BaseDataSource.createDataSource(properties,
org.apache.commons.dbcp2.BasicDataSource.class);

getPoolConfiguration().setUrl(null);
getPoolConfiguration().setDriverClassName(null);
getPoolConfiguration().setUsername(null);
getPoolConfiguration().setPassword(null);

clearConfiguration(getPoolConfiguration());
applyPoolConfiguration(dataSource, getPoolConfiguration());

return dataSource;
Expand All @@ -104,11 +104,7 @@ public com.alibaba.druid.pool.DruidDataSource createDataSource(){
final com.alibaba.druid.pool.DruidDataSource dataSource = BaseDataSource.createDataSource(properties,
com.alibaba.druid.pool.DruidDataSource.class);

getPoolConfiguration().setUrl(null);
getPoolConfiguration().setDriverClassName(null);
getPoolConfiguration().setUsername(null);
getPoolConfiguration().setPassword(null);

clearConfiguration(getPoolConfiguration());
applyPoolConfiguration(dataSource, getPoolConfiguration());

return dataSource;
Expand All @@ -130,11 +126,7 @@ public org.apache.tomcat.jdbc.pool.DataSource createDataSource(){
final org.apache.tomcat.jdbc.pool.DataSource dataSource = BaseDataSource.createDataSource(properties,
org.apache.tomcat.jdbc.pool.DataSource.class);

getPoolConfiguration().setUrl(null);
getPoolConfiguration().setDriverClassName(null);
getPoolConfiguration().setUsername(null);
getPoolConfiguration().setPassword(null);

clearConfiguration(getPoolConfiguration());
applyPoolConfiguration(dataSource, getPoolConfiguration());

return dataSource;
Expand All @@ -155,11 +147,7 @@ public GenericDataSource(final DataSourceProperties properties){
public javax.sql.DataSource createDataSource(){
final javax.sql.DataSource dataSource = BaseDataSource.createDataSource(properties, null);

getPoolConfiguration().setUrl(null);
getPoolConfiguration().setDriverClassName(null);
getPoolConfiguration().setUsername(null);
getPoolConfiguration().setPassword(null);

clearConfiguration(getPoolConfiguration());
applyPoolConfiguration(dataSource, getPoolConfiguration());

return dataSource;
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-geoip/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-geoip</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-httpclient</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-mongodb</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-mybatis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-mybatis</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-pac4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-pac4j</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
4 changes: 2 additions & 2 deletions buession-springboot-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<groupId>com.buession</groupId>
<artifactId>parent</artifactId>
<relativePath/>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<url>https://github.com/buession/buession-springboot</url>
<description>Buession Springboot Framework Parent</description>
<version>2.1.0</version>
<version>2.1.1</version>
<packaging>pom</packaging>

<organization>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-session/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-session</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-shiro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-shiro</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
package com.buession.springboot.shiro.autoconfigure;

import com.buession.core.utils.SystemPropertyUtils;
import com.buession.core.validator.Validate;
import com.buession.security.shiro.Cookie;
import com.buession.security.shiro.RedisManager;
Expand All @@ -48,6 +49,7 @@
import org.apache.shiro.spring.web.config.AbstractShiroWebConfiguration;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
Expand Down Expand Up @@ -82,63 +84,78 @@ public ShiroWebConfiguration(ShiroProperties properties){
// Session info
ShiroProperties.Session session = properties.getSession();

this.sessionManagerDeleteInvalidSessions = session.isSessionManagerDeleteInvalidSessions();
this.sessionIdCookieEnabled = session.isSessionIdCookieEnabled();
this.sessionIdUrlRewritingEnabled = session.isSessionIdUrlRewritingEnabled();
this.useNativeSessionManager = session.isUseNativeSessionManager();
SystemPropertyUtils.setProperty("shiro.sessionManager.deleteInvalidSessions",
session.isSessionManagerDeleteInvalidSessions());
SystemPropertyUtils.setProperty("shiro.sessionManager.sessionIdCookieEnabled",
session.isSessionIdCookieEnabled());
SystemPropertyUtils.setProperty("shiro.sessionManager.sessionIdUrlRewritingEnabled",
session.isSessionIdUrlRewritingEnabled());
SystemPropertyUtils.setProperty("shiro.userNativeSessionManager", session.isUseNativeSessionManager());
SystemPropertyUtils.setProperty("shiro.useNativeSessionManager", session.isUseNativeSessionManager());

// Session Cookie info
Cookie cookie = session.getCookie();

if(Validate.hasText(cookie.getName())){
this.sessionIdCookieName = cookie.getName();
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.name", cookie.getName());
}

if(cookie.getMaxAge() != null){
this.sessionIdCookieMaxAge = cookie.getMaxAge();
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.maxAge", cookie.getMaxAge());
}

if(Validate.hasText(cookie.getDomain())){
this.sessionIdCookieDomain = cookie.getDomain();
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.domain", cookie.getDomain());
}

if(Validate.hasText(cookie.getPath())){
this.sessionIdCookiePath = cookie.getPath();
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.path", cookie.getPath());
}

if(cookie.getSecure() != null){
this.sessionIdCookieSecure = cookie.getSecure();
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.secure", cookie.getSecure());
}

if(cookie.getSameSite() != null){
this.sessionIdCookieSameSite = sameSiteConverter.convert(cookie.getSameSite());
org.apache.shiro.web.servlet.Cookie.SameSiteOptions sameSiteOptions =
sameSiteConverter.convert(cookie.getSameSite());

if(sameSiteOptions != null){
SystemPropertyUtils.setProperty("shiro.sessionManager.cookie.sameSite",
sameSiteOptions.name());
}
}

// RememberMe Cookie info
Cookie rememberMeCookie = properties.getRememberMe().getCookie();

if(Validate.hasText(rememberMeCookie.getName())){
this.rememberMeCookieName = rememberMeCookie.getName();
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.name", rememberMeCookie.getName());
}

if(rememberMeCookie.getMaxAge() != null){
this.rememberMeCookieMaxAge = rememberMeCookie.getMaxAge();
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.maxAge", rememberMeCookie.getMaxAge());
}

if(Validate.hasText(rememberMeCookie.getDomain())){
this.rememberMeCookieDomain = rememberMeCookie.getDomain();
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.domain", rememberMeCookie.getDomain());
}

if(Validate.hasText(rememberMeCookie.getPath())){
this.rememberMeCookiePath = rememberMeCookie.getPath();
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.path", rememberMeCookie.getPath());
}

if(rememberMeCookie.getSecure() != null){
this.rememberMeCookieSecure = rememberMeCookie.getSecure();
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.secure", rememberMeCookie.getSecure());
}

if(rememberMeCookie.getSameSite() != null){
this.rememberMeSameSite = sameSiteConverter.convert(rememberMeCookie.getSameSite());
org.apache.shiro.web.servlet.Cookie.SameSiteOptions sameSiteOptions =
sameSiteConverter.convert(rememberMeCookie.getSameSite());

if(sameSiteOptions != null){
SystemPropertyUtils.setProperty("shiro.rememberMeManager.cookie.sameSite",
sameSiteOptions.name());
}
}
}

Expand Down Expand Up @@ -245,7 +262,7 @@ protected org.apache.shiro.web.servlet.Cookie rememberMeCookieTemplate(){
@Bean
@ConditionalOnMissingBean
@ConditionalOnResource(resources = "classpath:chainDefinition.ini")
protected ShiroFilterChainDefinition shiroFilterChainDefinition(SessionManager sessionManager){
protected ShiroFilterChainDefinition shiroFilterChainDefinition(ObjectProvider<SessionManager> sessionManager){
Ini ini = Ini.fromResourcePath("classpath:chainDefinition.ini");

if(Validate.isEmpty(ini)){
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-velocity</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down
2 changes: 1 addition & 1 deletion buession-springboot-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.springboot</groupId>
<artifactId>buession-springboot-parent</artifactId>
<relativePath>../buession-springboot-parent</relativePath>
<version>2.1.0</version>
<version>2.1.1</version>
</parent>
<artifactId>buession-springboot-web</artifactId>
<url>https://github.com/buession/buession-springboot</url>
Expand Down

0 comments on commit 68d2a91

Please sign in to comment.