Skip to content

Commit 37df9c6

Browse files
author
eugenp
committed
initial remember me work
1 parent 0d8cd51 commit 37df9c6

4 files changed

Lines changed: 52 additions & 40 deletions

File tree

spring-security-mvc-custom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@
198198
<junit.version>4.11</junit.version>
199199
<mockito.version>1.9.5</mockito.version>
200200

201-
<httpcore.version>4.2.4</httpcore.version>
202201
<httpclient.version>4.2.5</httpclient.version>
202+
<httpcore.version>4.2.4</httpcore.version>
203203

204204
<rest-assured.version>1.8.1</rest-assured.version>
205205
<groovy.version>1.8.9</groovy.version>

spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<form-login login-page='/login.html' authentication-success-handler-ref="myAuthenticationSuccessHandler" authentication-failure-url="/login.html?error=true" />
1515

1616
<logout delete-cookies="JSESSIONID" />
17-
17+
18+
<remember-me/>
19+
1820
</http>
1921

2022
<beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler" />

spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<td>Password:</td>
1616
<td><input type='password' name='j_password' /></td>
1717
</tr>
18+
<tr>
19+
<td>Remember Me:</td>
20+
<td><input type="checkbox" name="_spring_security_remember_me" /></td>
21+
</tr>
1822
<tr>
1923
<td><input name="submit" type="submit" value="submit" /></td>
2024
</tr>
Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,56 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
3-
xsi:schemaLocation="
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
4+
xsi:schemaLocation="
45
http://java.sun.com/xml/ns/javaee
5-
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
6+
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
7+
id="WebApp_ID" version="3.0">
68

7-
<display-name>Spring MVC Application</display-name>
9+
<display-name>Spring MVC Custom Application</display-name>
810

9-
<!-- Spring root -->
10-
<context-param>
11-
<param-name>contextClass</param-name>
12-
<param-value>
11+
<session-config>
12+
<session-timeout>1</session-timeout>
13+
</session-config>
14+
15+
<!-- Spring root -->
16+
<context-param>
17+
<param-name>contextClass</param-name>
18+
<param-value>
1319
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
1420
</param-value>
15-
</context-param>
16-
<context-param>
17-
<param-name>contextConfigLocation</param-name>
18-
<param-value>org.baeldung.spring</param-value>
19-
</context-param>
21+
</context-param>
22+
<context-param>
23+
<param-name>contextConfigLocation</param-name>
24+
<param-value>org.baeldung.spring</param-value>
25+
</context-param>
2026

21-
<listener>
22-
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
23-
</listener>
27+
<listener>
28+
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
29+
</listener>
2430

25-
<!-- Spring child -->
26-
<servlet>
27-
<servlet-name>mvc</servlet-name>
28-
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
29-
<load-on-startup>1</load-on-startup>
30-
</servlet>
31-
<servlet-mapping>
32-
<servlet-name>mvc</servlet-name>
33-
<url-pattern>/</url-pattern>
34-
</servlet-mapping>
31+
<!-- Spring child -->
32+
<servlet>
33+
<servlet-name>mvc</servlet-name>
34+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
35+
<load-on-startup>1</load-on-startup>
36+
</servlet>
37+
<servlet-mapping>
38+
<servlet-name>mvc</servlet-name>
39+
<url-pattern>/</url-pattern>
40+
</servlet-mapping>
3541

36-
<!-- Spring Security -->
37-
<filter>
38-
<filter-name>springSecurityFilterChain</filter-name>
39-
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
40-
</filter>
41-
<filter-mapping>
42-
<filter-name>springSecurityFilterChain</filter-name>
43-
<url-pattern>/*</url-pattern>
44-
</filter-mapping>
42+
<!-- Spring Security -->
43+
<filter>
44+
<filter-name>springSecurityFilterChain</filter-name>
45+
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
46+
</filter>
47+
<filter-mapping>
48+
<filter-name>springSecurityFilterChain</filter-name>
49+
<url-pattern>/*</url-pattern>
50+
</filter-mapping>
4551

46-
<!-- <welcome-file-list> -->
47-
<!-- <welcome-file>index.html</welcome-file> -->
48-
<!-- </welcome-file-list> -->
52+
<!-- <welcome-file-list> -->
53+
<!-- <welcome-file>index.html</welcome-file> -->
54+
<!-- </welcome-file-list> -->
4955

5056
</web-app>

0 commit comments

Comments
 (0)