File tree Expand file tree Collapse file tree 4 files changed +36
-3
lines changed
default-authorizationserver/src/main/java/sample/config Expand file tree Collapse file tree 4 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 54
54
55
55
/**
56
56
* @author Joe Grandja
57
+ * @author Dmitriy Dubson
57
58
* @since 0.0.1
58
59
*/
59
60
@ Configuration (proxyBeanMethods = false )
@@ -88,7 +89,7 @@ public RegisteredClientRepository registeredClientRepository(JdbcTemplate jdbcTe
88
89
.authorizationGrantType (AuthorizationGrantType .CLIENT_CREDENTIALS )
89
90
.redirectUri ("http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc" )
90
91
.redirectUri ("http://127.0.0.1:8080/authorized" )
91
- .postLogoutRedirectUri ("http://127.0.0.1:8080/index " )
92
+ .postLogoutRedirectUri ("http://127.0.0.1:8080/logged-out " )
92
93
.scope (OidcScopes .OPENID )
93
94
.scope (OidcScopes .PROFILE )
94
95
.scope ("message.read" )
Original file line number Diff line number Diff line change 30
30
31
31
/**
32
32
* @author Joe Grandja
33
+ * @author Dmitriy Dubson
33
34
* @since 0.0.1
34
35
*/
35
36
@ EnableWebSecurity
@@ -49,7 +50,9 @@ WebSecurityCustomizer webSecurityCustomizer() {
49
50
SecurityFilterChain securityFilterChain (HttpSecurity http ) throws Exception {
50
51
http
51
52
.authorizeHttpRequests (authorize ->
52
- authorize .anyRequest ().authenticated ()
53
+ authorize
54
+ .requestMatchers ("/logged-out" ).permitAll ()
55
+ .anyRequest ().authenticated ()
53
56
)
54
57
.oauth2Login (oauth2Login ->
55
58
oauth2Login .loginPage ("/oauth2/authorization/messaging-client-oidc" ))
@@ -66,7 +69,7 @@ private LogoutSuccessHandler oidcLogoutSuccessHandler() {
66
69
67
70
// Set the location that the End-User's User Agent will be redirected to
68
71
// after the logout has been performed at the Provider
69
- oidcLogoutSuccessHandler .setPostLogoutRedirectUri ("{baseUrl}/index " );
72
+ oidcLogoutSuccessHandler .setPostLogoutRedirectUri ("{baseUrl}/logged-out " );
70
73
71
74
return oidcLogoutSuccessHandler ;
72
75
}
Original file line number Diff line number Diff line change 20
20
21
21
/**
22
22
* @author Joe Grandja
23
+ * @author Dmitriy Dubson
23
24
* @since 0.0.1
24
25
*/
25
26
@ Controller
@@ -34,4 +35,10 @@ public String root() {
34
35
public String index () {
35
36
return "index" ;
36
37
}
38
+
39
+ @ GetMapping ("/logged-out" )
40
+ public String loggedOut () {
41
+ return "logged-out" ;
42
+ }
43
+
37
44
}
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html xmlns ="http://www.w3.org/1999/xhtml " xmlns:th ="https://www.thymeleaf.org " xmlns:sec ="https://www.thymeleaf.org/thymeleaf-extras-springsecurity6 ">
3
+ < head >
4
+ < title > Spring Security OAuth 2.0 Sample</ title >
5
+ < meta charset ="utf-8 "/>
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge "/>
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1, shrink-to-fit=no ">
8
+ < link rel ="stylesheet " href ="/webjars/bootstrap/css/bootstrap.css "
9
+ th:href ="@{/webjars/bootstrap/css/bootstrap.css} "/>
10
+ </ head >
11
+ < body >
12
+ < div th:fragment ="header ">
13
+ < nav class ="navbar navbar-default "> </ nav >
14
+ </ div >
15
+ < div class ="container ">
16
+ < h1 > You are now logged out.</ h1 >
17
+ < a href ="/ " th:href ="@{/} "> Go back home</ a >
18
+ </ div >
19
+ < script src ="/webjars/jquery/jquery.min.js " th:src ="@{/webjars/jquery/jquery.min.js} "> </ script >
20
+ < script src ="/webjars/bootstrap/js/bootstrap.min.js " th:src ="@{/webjars/bootstrap/js/bootstrap.min.js} "> </ script >
21
+ </ body >
22
+ </ html >
You can’t perform that action at this time.
0 commit comments