Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,20 @@ private Mono<String> extractRedirectUrlAndSendVerificationMail(
private Mono<Void> postVerificationRequiredHandler(
WebFilterExchange webFilterExchange, User user, Application defaultApplication) {
return webFilterExchange.getExchange().getSession().flatMap(webSession -> {
// First remove the security context from the session attributes
webSession.getAttributes().remove(DEFAULT_SPRING_SECURITY_CONTEXT_ATTR_NAME);
return redirectHelper
.getAuthSuccessRedirectUrl(webFilterExchange, defaultApplication, true)
.flatMap(redirectUrl -> extractRedirectUrlAndSendVerificationMail(
webFilterExchange, user, redirectUrl)
.map(url -> String.format(
"/user/verificationPending?email=%s",
URLEncoder.encode(user.getEmail(), StandardCharsets.UTF_8)))
.flatMap(redirectUri -> redirectStrategy.sendRedirect(
webFilterExchange.getExchange(), URI.create(redirectUri))));
// Then invalidate the entire session to remove it from Redis
return webSession
.invalidate()
.then(redirectHelper
.getAuthSuccessRedirectUrl(webFilterExchange, defaultApplication, true)
.flatMap(redirectUrl -> extractRedirectUrlAndSendVerificationMail(
webFilterExchange, user, redirectUrl)
.map(url -> String.format(
"/user/verificationPending?email=%s",
URLEncoder.encode(user.getEmail(), StandardCharsets.UTF_8)))
.flatMap(redirectUri -> redirectStrategy.sendRedirect(
webFilterExchange.getExchange(), URI.create(redirectUri)))));
});
}

Expand Down
Loading