new session work

This commit is contained in:
eugenp 2013-08-11 15:29:10 +03:00
parent a72cec5f10
commit 5b2fd4d013
3 changed files with 13 additions and 4 deletions

View File

@ -27,6 +27,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
registry.addViewController("/login.html");
registry.addViewController("/homepage.html");
registry.addViewController("/sessionExpired.html");
registry.addViewController("/invalidExpired.html");
registry.addViewController("/console.html");
}

View File

@ -6,7 +6,7 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
<http use-expressions="true">
<http create-session="always" use-expressions="true">
<intercept-url pattern="/anonymous*" access="isAnonymous()" />
<intercept-url pattern="/login*" access="permitAll" />
<intercept-url pattern="/**" access="isAuthenticated()" />
@ -14,9 +14,13 @@
<form-login login-page='/login.html' authentication-success-handler-ref="myAuthenticationSuccessHandler" authentication-failure-url="/login.html?error=true" />
<logout delete-cookies="JSESSIONID" />
<remember-me key="uniqueAndSecret" token-validity-seconds="86400"/>
<remember-me key="uniqueAndSecret" token-validity-seconds="86400" />
<session-management>
<concurrency-control max-sessions="2" />
</session-management>
</http>
<beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler" />

View File

@ -12,6 +12,9 @@
<listener>
<listener-class>org.baeldung.web.SessionListenerWithMetrics</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
</listener>
<!-- Spring root -->
<context-param>