serverRedirectStrategy->redirectStrategy
Issue: gh-4822
This commit is contained in:
@@ -39,7 +39,7 @@ public class RedirectServerAuthenticationEntryPoint
|
||||
implements ServerAuthenticationEntryPoint {
|
||||
private final URI location;
|
||||
|
||||
private ServerRedirectStrategy serverRedirectStrategy = new DefaultServerRedirectStrategy();
|
||||
private ServerRedirectStrategy redirectStrategy = new DefaultServerRedirectStrategy();
|
||||
|
||||
private ServerRequestCache requestCache = new WebSessionServerRequestCache();
|
||||
|
||||
@@ -56,15 +56,15 @@ public class RedirectServerAuthenticationEntryPoint
|
||||
@Override
|
||||
public Mono<Void> commence(ServerWebExchange exchange, AuthenticationException e) {
|
||||
return this.requestCache.saveRequest(exchange)
|
||||
.then(this.serverRedirectStrategy.sendRedirect(exchange, this.location));
|
||||
.then(this.redirectStrategy.sendRedirect(exchange, this.location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the RedirectStrategy to use.
|
||||
* @param serverRedirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
* @param redirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
*/
|
||||
public void setServerRedirectStrategy(ServerRedirectStrategy serverRedirectStrategy) {
|
||||
Assert.notNull(serverRedirectStrategy, "redirectStrategy cannot be null");
|
||||
this.serverRedirectStrategy = serverRedirectStrategy;
|
||||
public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy) {
|
||||
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
|
||||
this.redirectStrategy = redirectStrategy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class RedirectServerAuthenticationFailureHandler
|
||||
implements ServerAuthenticationFailureHandler {
|
||||
private final URI location;
|
||||
|
||||
private ServerRedirectStrategy serverRedirectStrategy = new DefaultServerRedirectStrategy();
|
||||
private ServerRedirectStrategy redirectStrategy = new DefaultServerRedirectStrategy();
|
||||
|
||||
public RedirectServerAuthenticationFailureHandler(String location) {
|
||||
Assert.notNull(location, "location cannot be null");
|
||||
@@ -44,16 +44,16 @@ public class RedirectServerAuthenticationFailureHandler
|
||||
|
||||
/**
|
||||
* Sets the RedirectStrategy to use.
|
||||
* @param serverRedirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
* @param redirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
*/
|
||||
public void setServerRedirectStrategy(ServerRedirectStrategy serverRedirectStrategy) {
|
||||
Assert.notNull(serverRedirectStrategy, "redirectStrategy cannot be null");
|
||||
this.serverRedirectStrategy = serverRedirectStrategy;
|
||||
public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy) {
|
||||
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
|
||||
this.redirectStrategy = redirectStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> onAuthenticationFailure(
|
||||
WebFilterExchange webFilterExchange, AuthenticationException exception) {
|
||||
return this.serverRedirectStrategy.sendRedirect(webFilterExchange.getExchange(), this.location);
|
||||
return this.redirectStrategy.sendRedirect(webFilterExchange.getExchange(), this.location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RedirectServerAuthenticationSuccessHandler
|
||||
implements ServerAuthenticationSuccessHandler {
|
||||
private URI location = URI.create("/");
|
||||
|
||||
private ServerRedirectStrategy serverRedirectStrategy = new DefaultServerRedirectStrategy();
|
||||
private ServerRedirectStrategy redirectStrategy = new DefaultServerRedirectStrategy();
|
||||
|
||||
private ServerRequestCache requestCache = new WebSessionServerRequestCache();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class RedirectServerAuthenticationSuccessHandler
|
||||
.map(r -> r.getPath().pathWithinApplication().value())
|
||||
.map(URI::create)
|
||||
.defaultIfEmpty(this.location)
|
||||
.flatMap(location -> this.serverRedirectStrategy.sendRedirect(exchange, location));
|
||||
.flatMap(location -> this.redirectStrategy.sendRedirect(exchange, location));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,10 +73,10 @@ public class RedirectServerAuthenticationSuccessHandler
|
||||
|
||||
/**
|
||||
* The RedirectStrategy to use.
|
||||
* @param serverRedirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
* @param redirectStrategy the strategy to use. Default is DefaultRedirectStrategy.
|
||||
*/
|
||||
public void setServerRedirectStrategy(ServerRedirectStrategy serverRedirectStrategy) {
|
||||
Assert.notNull(serverRedirectStrategy, "redirectStrategy cannot be null");
|
||||
this.serverRedirectStrategy = serverRedirectStrategy;
|
||||
public void setRedirectStrategy(ServerRedirectStrategy redirectStrategy) {
|
||||
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
|
||||
this.redirectStrategy = redirectStrategy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ public class RedirectServerLogoutSuccessHandler implements ServerLogoutSuccessHa
|
||||
|
||||
private URI logoutSuccessUrl = URI.create(DEFAULT_LOGOUT_SUCCESS_URL);
|
||||
|
||||
private ServerRedirectStrategy serverRedirectStrategy = new DefaultServerRedirectStrategy();
|
||||
private ServerRedirectStrategy redirectStrategy = new DefaultServerRedirectStrategy();
|
||||
|
||||
@Override
|
||||
public Mono<Void> onLogoutSuccess(WebFilterExchange exchange, Authentication authentication) {
|
||||
return this.serverRedirectStrategy
|
||||
return this.redirectStrategy
|
||||
.sendRedirect(exchange.getExchange(), this.logoutSuccessUrl);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user