serverAuthenticationSuccessHandler->authenticationSuccessHandler
Issue: gh-4822
This commit is contained in:
parent
5c83f92ddc
commit
520e0a5a68
|
@ -543,17 +543,17 @@ public class ServerHttpSecurity {
|
|||
|
||||
private ServerAuthenticationFailureHandler authenticationFailureHandler;
|
||||
|
||||
private ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler = this.defaultSuccessHandler;
|
||||
private ServerAuthenticationSuccessHandler authenticationSuccessHandler = this.defaultSuccessHandler;
|
||||
|
||||
public FormLoginSpec authenticationManager(ReactiveAuthenticationManager authenticationManager) {
|
||||
this.authenticationManager = authenticationManager;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FormLoginSpec serverAuthenticationSuccessHandler(
|
||||
ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler) {
|
||||
Assert.notNull(serverAuthenticationSuccessHandler, "serverAuthenticationSuccessHandler cannot be null");
|
||||
this.serverAuthenticationSuccessHandler = serverAuthenticationSuccessHandler;
|
||||
public FormLoginSpec authenticationSuccessHandler(
|
||||
ServerAuthenticationSuccessHandler authenticationSuccessHandler) {
|
||||
Assert.notNull(authenticationSuccessHandler, "authenticationSuccessHandler cannot be null");
|
||||
this.authenticationSuccessHandler = authenticationSuccessHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ public class ServerHttpSecurity {
|
|||
authenticationFilter.setRequiresAuthenticationMatcher(this.requiresAuthenticationMatcher);
|
||||
authenticationFilter.setAuthenticationFailureHandler(this.authenticationFailureHandler);
|
||||
authenticationFilter.setAuthenticationConverter(new ServerFormLoginAuthenticationConverter());
|
||||
authenticationFilter.setServerAuthenticationSuccessHandler(this.serverAuthenticationSuccessHandler);
|
||||
authenticationFilter.setAuthenticationSuccessHandler(this.authenticationSuccessHandler);
|
||||
authenticationFilter.setSecurityContextRepository(this.securityContextRepository);
|
||||
http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.FORM_LOGIN);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class FormLoginTests {
|
|||
.anyExchange().authenticated()
|
||||
.and()
|
||||
.formLogin()
|
||||
.serverAuthenticationSuccessHandler(new RedirectServerAuthenticationSuccessHandler("/custom"))
|
||||
.authenticationSuccessHandler(new RedirectServerAuthenticationSuccessHandler("/custom"))
|
||||
.and()
|
||||
.build();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class AuthenticationWebFilter implements WebFilter {
|
|||
|
||||
private final ReactiveAuthenticationManager authenticationManager;
|
||||
|
||||
private ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler();
|
||||
private ServerAuthenticationSuccessHandler authenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler();
|
||||
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class AuthenticationWebFilter implements WebFilter {
|
|||
SecurityContextImpl securityContext = new SecurityContextImpl();
|
||||
securityContext.setAuthentication(authentication);
|
||||
return this.securityContextRepository.save(exchange, securityContext)
|
||||
.then(this.serverAuthenticationSuccessHandler
|
||||
.then(this.authenticationSuccessHandler
|
||||
.onAuthenticationSuccess(webFilterExchange, authentication));
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,8 @@ public class AuthenticationWebFilter implements WebFilter {
|
|||
this.securityContextRepository = securityContextRepository;
|
||||
}
|
||||
|
||||
public void setServerAuthenticationSuccessHandler(ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler) {
|
||||
this.serverAuthenticationSuccessHandler = serverAuthenticationSuccessHandler;
|
||||
public void setAuthenticationSuccessHandler(ServerAuthenticationSuccessHandler authenticationSuccessHandler) {
|
||||
this.authenticationSuccessHandler = authenticationSuccessHandler;
|
||||
}
|
||||
|
||||
public void setAuthenticationConverter(Function<ServerWebExchange,Mono<Authentication>> authenticationConverter) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class AuthenticationWebFilterTests {
|
|||
@Before
|
||||
public void setup() {
|
||||
this.filter = new AuthenticationWebFilter(this.authenticationManager);
|
||||
this.filter.setServerAuthenticationSuccessHandler(this.successHandler);
|
||||
this.filter.setAuthenticationSuccessHandler(this.successHandler);
|
||||
this.filter.setAuthenticationConverter(this.authenticationConverter);
|
||||
this.filter.setSecurityContextRepository(this.securityContextRepository);
|
||||
this.filter.setAuthenticationFailureHandler(this.failureHandler);
|
||||
|
|
Loading…
Reference in New Issue