serverLogoutSuccessHandler->logoutSuccessHandler

Issue: gh-4822
This commit is contained in:
Rob Winch 2017-11-14 15:32:25 -06:00
parent bf570854b8
commit 11f6e0477c
2 changed files with 9 additions and 8 deletions

View File

@ -753,7 +753,7 @@ public class ServerHttpSecurity {
} }
public LogoutSpec logoutSuccessHandler(ServerLogoutSuccessHandler handler) { public LogoutSpec logoutSuccessHandler(ServerLogoutSuccessHandler handler) {
this.logoutWebFilter.setServerLogoutSuccessHandler(handler); this.logoutWebFilter.setLogoutSuccessHandler(handler);
return this; return this;
} }

View File

@ -44,7 +44,7 @@ public class LogoutWebFilter implements WebFilter {
private ServerLogoutHandler logoutHandler = new SecurityContextServerLogoutHandler(); private ServerLogoutHandler logoutHandler = new SecurityContextServerLogoutHandler();
private ServerLogoutSuccessHandler serverLogoutSuccessHandler = new RedirectServerLogoutSuccessHandler(); private ServerLogoutSuccessHandler logoutSuccessHandler = new RedirectServerLogoutSuccessHandler();
private ServerWebExchangeMatcher requiresLogout = ServerWebExchangeMatchers private ServerWebExchangeMatcher requiresLogout = ServerWebExchangeMatchers
.pathMatchers(HttpMethod.POST, "/logout"); .pathMatchers(HttpMethod.POST, "/logout");
@ -70,18 +70,19 @@ public class LogoutWebFilter implements WebFilter {
private Mono<Void> logout(WebFilterExchange webFilterExchange, Authentication authentication) { private Mono<Void> logout(WebFilterExchange webFilterExchange, Authentication authentication) {
return this.logoutHandler.logout(webFilterExchange, authentication) return this.logoutHandler.logout(webFilterExchange, authentication)
.then(this.serverLogoutSuccessHandler.onLogoutSuccess(webFilterExchange, authentication)) .then(this.logoutSuccessHandler
.onLogoutSuccess(webFilterExchange, authentication))
.subscriberContext(ReactiveSecurityContextHolder.clearContext()); .subscriberContext(ReactiveSecurityContextHolder.clearContext());
} }
/** /**
* Sets the {@link ServerLogoutSuccessHandler}. The default is {@link RedirectServerLogoutSuccessHandler}. * Sets the {@link ServerLogoutSuccessHandler}. The default is {@link RedirectServerLogoutSuccessHandler}.
* @param serverLogoutSuccessHandler the handler to use * @param logoutSuccessHandler the handler to use
*/ */
public void setServerLogoutSuccessHandler( public void setLogoutSuccessHandler(
ServerLogoutSuccessHandler serverLogoutSuccessHandler) { ServerLogoutSuccessHandler logoutSuccessHandler) {
Assert.notNull(serverLogoutSuccessHandler, "serverLogoutSuccessHandler cannot be null"); Assert.notNull(logoutSuccessHandler, "logoutSuccessHandler cannot be null");
this.serverLogoutSuccessHandler = serverLogoutSuccessHandler; this.logoutSuccessHandler = logoutSuccessHandler;
} }
public void setLogoutHandler(ServerLogoutHandler logoutHandler) { public void setLogoutHandler(ServerLogoutHandler logoutHandler) {