serverAuthenticationSuccessHandler->authenticationSuccessHandler

Issue: gh-4822
This commit is contained in:
Rob Winch 2017-11-14 15:05:06 -06:00
parent 5c83f92ddc
commit 520e0a5a68
4 changed files with 12 additions and 12 deletions

View File

@ -543,17 +543,17 @@ public class ServerHttpSecurity {
private ServerAuthenticationFailureHandler authenticationFailureHandler; private ServerAuthenticationFailureHandler authenticationFailureHandler;
private ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler = this.defaultSuccessHandler; private ServerAuthenticationSuccessHandler authenticationSuccessHandler = this.defaultSuccessHandler;
public FormLoginSpec authenticationManager(ReactiveAuthenticationManager authenticationManager) { public FormLoginSpec authenticationManager(ReactiveAuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager; this.authenticationManager = authenticationManager;
return this; return this;
} }
public FormLoginSpec serverAuthenticationSuccessHandler( public FormLoginSpec authenticationSuccessHandler(
ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler) { ServerAuthenticationSuccessHandler authenticationSuccessHandler) {
Assert.notNull(serverAuthenticationSuccessHandler, "serverAuthenticationSuccessHandler cannot be null"); Assert.notNull(authenticationSuccessHandler, "authenticationSuccessHandler cannot be null");
this.serverAuthenticationSuccessHandler = serverAuthenticationSuccessHandler; this.authenticationSuccessHandler = authenticationSuccessHandler;
return this; return this;
} }
@ -614,7 +614,7 @@ public class ServerHttpSecurity {
authenticationFilter.setRequiresAuthenticationMatcher(this.requiresAuthenticationMatcher); authenticationFilter.setRequiresAuthenticationMatcher(this.requiresAuthenticationMatcher);
authenticationFilter.setAuthenticationFailureHandler(this.authenticationFailureHandler); authenticationFilter.setAuthenticationFailureHandler(this.authenticationFailureHandler);
authenticationFilter.setAuthenticationConverter(new ServerFormLoginAuthenticationConverter()); authenticationFilter.setAuthenticationConverter(new ServerFormLoginAuthenticationConverter());
authenticationFilter.setServerAuthenticationSuccessHandler(this.serverAuthenticationSuccessHandler); authenticationFilter.setAuthenticationSuccessHandler(this.authenticationSuccessHandler);
authenticationFilter.setSecurityContextRepository(this.securityContextRepository); authenticationFilter.setSecurityContextRepository(this.securityContextRepository);
http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.FORM_LOGIN); http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.FORM_LOGIN);
} }

View File

@ -124,7 +124,7 @@ public class FormLoginTests {
.anyExchange().authenticated() .anyExchange().authenticated()
.and() .and()
.formLogin() .formLogin()
.serverAuthenticationSuccessHandler(new RedirectServerAuthenticationSuccessHandler("/custom")) .authenticationSuccessHandler(new RedirectServerAuthenticationSuccessHandler("/custom"))
.and() .and()
.build(); .build();

View File

@ -43,7 +43,7 @@ public class AuthenticationWebFilter implements WebFilter {
private final ReactiveAuthenticationManager authenticationManager; private final ReactiveAuthenticationManager authenticationManager;
private ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler(); private ServerAuthenticationSuccessHandler authenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler();
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter(); private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
@ -81,7 +81,7 @@ public class AuthenticationWebFilter implements WebFilter {
SecurityContextImpl securityContext = new SecurityContextImpl(); SecurityContextImpl securityContext = new SecurityContextImpl();
securityContext.setAuthentication(authentication); securityContext.setAuthentication(authentication);
return this.securityContextRepository.save(exchange, securityContext) return this.securityContextRepository.save(exchange, securityContext)
.then(this.serverAuthenticationSuccessHandler .then(this.authenticationSuccessHandler
.onAuthenticationSuccess(webFilterExchange, authentication)); .onAuthenticationSuccess(webFilterExchange, authentication));
} }
@ -91,8 +91,8 @@ public class AuthenticationWebFilter implements WebFilter {
this.securityContextRepository = securityContextRepository; this.securityContextRepository = securityContextRepository;
} }
public void setServerAuthenticationSuccessHandler(ServerAuthenticationSuccessHandler serverAuthenticationSuccessHandler) { public void setAuthenticationSuccessHandler(ServerAuthenticationSuccessHandler authenticationSuccessHandler) {
this.serverAuthenticationSuccessHandler = serverAuthenticationSuccessHandler; this.authenticationSuccessHandler = authenticationSuccessHandler;
} }
public void setAuthenticationConverter(Function<ServerWebExchange,Mono<Authentication>> authenticationConverter) { public void setAuthenticationConverter(Function<ServerWebExchange,Mono<Authentication>> authenticationConverter) {

View File

@ -69,7 +69,7 @@ public class AuthenticationWebFilterTests {
@Before @Before
public void setup() { public void setup() {
this.filter = new AuthenticationWebFilter(this.authenticationManager); this.filter = new AuthenticationWebFilter(this.authenticationManager);
this.filter.setServerAuthenticationSuccessHandler(this.successHandler); this.filter.setAuthenticationSuccessHandler(this.successHandler);
this.filter.setAuthenticationConverter(this.authenticationConverter); this.filter.setAuthenticationConverter(this.authenticationConverter);
this.filter.setSecurityContextRepository(this.securityContextRepository); this.filter.setSecurityContextRepository(this.securityContextRepository);
this.filter.setAuthenticationFailureHandler(this.failureHandler); this.filter.setAuthenticationFailureHandler(this.failureHandler);