更新shiro版本,去除sessionid url显示问题

This commit is contained in:
zxm 2018-07-14 15:48:59 +08:00
parent 50782498a6
commit 70d55f663d
2 changed files with 35 additions and 22 deletions

View File

@ -14,6 +14,7 @@ import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
@ -64,6 +65,7 @@ public class ShiroConfig {
DefaultWebSecurityManager dwm=new DefaultWebSecurityManager();
dwm.setRealm(loginRealm);
dwm.setCacheManager(getCacheManager());
dwm.setSessionManager(defaultWebSessionManager());
return dwm;
}
@ -118,6 +120,17 @@ public class ShiroConfig {
as.setSecurityManager(securityManager);
return as;
}
@Bean
public DefaultWebSessionManager defaultWebSessionManager() {
DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager();
defaultWebSessionManager.setSessionIdCookieEnabled(true);
defaultWebSessionManager.setGlobalSessionTimeout(21600000);
defaultWebSessionManager.setDeleteInvalidSessions(true);
defaultWebSessionManager.setSessionValidationSchedulerEnabled(true);
defaultWebSessionManager.setSessionIdUrlRewritingEnabled(false);
return defaultWebSessionManager;
}
/*
@Bean
public FilterRegistrationBean delegatingFilterProxy(){

44
pom.xml
View File

@ -94,11 +94,11 @@
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>-->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>-->
<!--Mysql数据库驱动-->
@ -175,7 +175,7 @@
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.2.2</version>
<version>1.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-aspectj -->
@ -197,7 +197,7 @@
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
<version>1.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
@ -211,12 +211,12 @@
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.3</version>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.2.3</version>
<version>1.3.2</version>
</dependency>
<dependency>
@ -327,7 +327,7 @@
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-quartz</artifactId>
<version>1.2.3</version>
<version>1.3.2</version>
<!-- 解决 shiro和quartz 冲突-->
<exclusions>
<exclusion>
@ -422,18 +422,18 @@
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
<!-- <dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>-->
<!-- <dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>-->
</plugin>
</plugins>
</build>