ServerRedirectCache.getRequest->getRedirectUri
Issue: gh-4789
This commit is contained in:
@@ -55,7 +55,7 @@ public class RedirectServerAuthenticationSuccessHandler
|
||||
public Mono<Void> onAuthenticationSuccess(WebFilterExchange webFilterExchange,
|
||||
Authentication authentication) {
|
||||
ServerWebExchange exchange = webFilterExchange.getExchange();
|
||||
return this.requestCache.getRequest(exchange)
|
||||
return this.requestCache.getRedirectUri(exchange)
|
||||
.defaultIfEmpty(this.location)
|
||||
.flatMap(location -> this.redirectStrategy.sendRedirect(exchange, location));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class NoOpServerRequestCache implements ServerRequestCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<URI> getRequest(ServerWebExchange exchange) {
|
||||
public Mono<URI> getRedirectUri(ServerWebExchange exchange) {
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public interface ServerRequestCache {
|
||||
Mono<Void> saveRequest(ServerWebExchange exchange);
|
||||
|
||||
/**
|
||||
* Get the saved {@link ServerHttpRequest}
|
||||
* Get the URI that can be redirected to trigger the saved request to be used
|
||||
* @param exchange the exchange to obtain the saved {@link ServerHttpRequest} from
|
||||
* @return the {@link ServerHttpRequest}
|
||||
* @return the URI that can be redirected to trigger the saved request to be used
|
||||
*/
|
||||
Mono<URI> getRequest(ServerWebExchange exchange);
|
||||
Mono<URI> getRedirectUri(ServerWebExchange exchange);
|
||||
|
||||
/**
|
||||
* If the provided {@link ServerWebExchange} matches the saved {@link ServerHttpRequest}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class WebSessionServerRequestCache implements ServerRequestCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<URI> getRequest(ServerWebExchange exchange) {
|
||||
public Mono<URI> getRedirectUri(ServerWebExchange exchange) {
|
||||
return exchange.getSession()
|
||||
.flatMap(session -> Mono.justOrEmpty(session.<String>getAttribute(this.sessionAttrName)))
|
||||
.map(URI::create);
|
||||
@@ -79,7 +79,7 @@ public class WebSessionServerRequestCache implements ServerRequestCache {
|
||||
@Override
|
||||
public Mono<ServerHttpRequest> getMatchingRequest(
|
||||
ServerWebExchange exchange) {
|
||||
return getRequest(exchange)
|
||||
return getRedirectUri(exchange)
|
||||
.map(URI::toASCIIString)
|
||||
.map(path -> exchange.getRequest().mutate().path(path).build())
|
||||
.filter( request -> pathInApplication(request).equals(
|
||||
|
||||
Reference in New Issue
Block a user