Skip to content

Commit

Permalink
AUT-2042 Send post-logout-redirect-uri as query parameter when loggin…
Browse files Browse the repository at this point in the history
…g out
  • Loading branch information
Marten332 committed Dec 13, 2024
1 parent df3f343 commit eb696d8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public class ClientController {
private String applicationIntroLong;
@Value("${example-client.messages.info-service}")
private String applicationInfoService;
@Value("${govsso.post-logout-redirect-uri}")
private String postLogoutRedirectUri;

@GetMapping(value = LOGIN_VIEW_MAPPING, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView clientLoginView(
Expand Down Expand Up @@ -89,10 +87,6 @@ public ModelAndView dashboard(@AuthenticationPrincipal OidcUser oidcUser, Exampl
if (locale != null) {
model.addObject("ui_locales", locale);
}
String postLogoutRedirectUri = LogoutUtil.postLogoutRedirectUri(request, this.postLogoutRedirectUri);
if (postLogoutRedirectUri != null) {
model.addObject("post_logout_redirect_uri", postLogoutRedirectUri);
}
}

log.info("Showing dashboard for subject='{}'", oidcUser.getSubject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ private String endpointUri(HttpServletRequest request, URI endSessionEndpoint, S
if (StringUtils.isNotEmpty(locale)) {
builder.queryParam(UI_LOCALES_PARAMETER, locale);
}
if (postLogoutRedirectUri != null) {
builder.queryParam("post_logout_redirect_uri", postLogoutRedirectUri);
}
}
if (postLogoutRedirectUri != null) {
builder.queryParam("post_logout_redirect_uri", postLogoutRedirectUri);
}

return builder.encode(StandardCharsets.UTF_8)
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<form method="post" th:action="@{/oauth/logout}" id="logoutFormPost">
<input type="hidden" th:id="id_token_hint" name="id_token_hint" th:value="${id_token}">
<input th:if="${ui_locales}" type="hidden" th:id="ui_locales" name="ui_locales" th:value="${ui_locales}">
<input th:if="${post_logout_redirect_uri}" type="hidden" th:id="post_logout_redirect_uri" name="post_logout_redirect_uri" th:value="${post_logout_redirect_uri}">
<input class="btn btn-outline-secondary" name="logout_button" type="submit" value="Log out (POST)"/>
</form>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void authenticationAndLogout() {
.post("/oauth/logout")
.then()
.statusCode(307)
.header("Location", "https://inproxy.localhost:13442/oauth2/sessions/logout");
.header("Location", "https://inproxy.localhost:13442/oauth2/sessions/logout?post_logout_redirect_uri=https://clienta.localhost:11443/?show-post-logout-message");
}

private static String getQueryParam(UriComponents locationComponents, String paramName) {
Expand Down

0 comments on commit eb696d8

Please sign in to comment.