parent
5baf71f4a0
commit
5fd84a62b5
|
@ -47,7 +47,13 @@ public class LogoutWebFiter implements WebFilter {
|
|||
return this.requiresLogout.matches(exchange)
|
||||
.filter( result -> result.isMatch())
|
||||
.switchIfEmpty(chain.filter(exchange).then(Mono.empty()))
|
||||
.flatMap( result -> exchange.getPrincipal().cast(Authentication.class))
|
||||
.flatMap( result -> authentication(exchange))
|
||||
.flatMap( authentication -> this.logoutHandler.logout(new WebFilterExchange(exchange, chain), authentication));
|
||||
}
|
||||
|
||||
private Mono<Authentication> authentication(ServerWebExchange exchange) {
|
||||
return exchange.getPrincipal()
|
||||
.cast(Authentication.class)
|
||||
.defaultIfEmpty(this.anonymousAuthenticationToken);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue