Fix logout in sample secure web applications
Fixes gh-1536
This commit is contained in:
parent
a36d1e2eed
commit
3c50386970
|
|
@ -76,7 +76,7 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest()
|
http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest()
|
||||||
.fullyAuthenticated().and().formLogin().loginPage("/login")
|
.fullyAuthenticated().and().formLogin().loginPage("/login")
|
||||||
.failureUrl("/login?error").permitAll();
|
.failureUrl("/login?error").permitAll().and().logout().permitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
Plain </a>
|
Plain </a>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
||||||
<li><a th:href="@{/logout}" href="logout"> Logout </a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -21,6 +20,9 @@
|
||||||
<div th:text="${message}">Fake content</div>
|
<div th:text="${message}">Fake content</div>
|
||||||
<div id="created" th:text="${#dates.format(date)}">July 11,
|
<div id="created" th:text="${#dates.format(date)}">July 11,
|
||||||
2012 2:17:16 PM CDT</div>
|
2012 2:17:16 PM CDT</div>
|
||||||
|
<form th:action="@{/logout}" method="post">
|
||||||
|
<input type="submit" value="Sign Out"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest()
|
http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest()
|
||||||
.fullyAuthenticated().and().formLogin().loginPage("/login")
|
.fullyAuthenticated().and().formLogin().loginPage("/login")
|
||||||
.failureUrl("/login?error").permitAll();
|
.failureUrl("/login?error").permitAll().and().logout().permitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
Plain </a>
|
Plain </a>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
||||||
<li><a th:href="@{/logout}" href="logout"> Logout </a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -21,6 +20,9 @@
|
||||||
<div th:text="${message}">Fake content</div>
|
<div th:text="${message}">Fake content</div>
|
||||||
<div id="created" th:text="${#dates.format(date)}">July 11,
|
<div id="created" th:text="${#dates.format(date)}">July 11,
|
||||||
2012 2:17:16 PM CDT</div>
|
2012 2:17:16 PM CDT</div>
|
||||||
|
<form th:action="@{/logout}" method="post">
|
||||||
|
<input type="submit" value="Sign Out"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,8 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests().anyRequest().fullyAuthenticated().and().formLogin()
|
http.authorizeRequests().anyRequest().fullyAuthenticated().and().formLogin()
|
||||||
.loginPage("/login").failureUrl("/login?error").permitAll();
|
.loginPage("/login").failureUrl("/login?error").permitAll().and()
|
||||||
|
.logout().permitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
Plain </a>
|
Plain </a>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
<li><a th:href="@{/}" href="home.html"> Home </a></li>
|
||||||
<li><a th:href="@{/logout}" href="logout"> Logout </a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -21,6 +20,9 @@
|
||||||
<div th:text="${message}">Fake content</div>
|
<div th:text="${message}">Fake content</div>
|
||||||
<div id="created" th:text="${#dates.format(date)}">July 11,
|
<div id="created" th:text="${#dates.format(date)}">July 11,
|
||||||
2012 2:17:16 PM CDT</div>
|
2012 2:17:16 PM CDT</div>
|
||||||
|
<form th:action="@{/logout}" method="post">
|
||||||
|
<input type="submit" value="Sign Out"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue