Require GeneratedOneTimeTokenHandler on constructor
Issue gh-15114
This commit is contained in:
parent
54d683fd6b
commit
a88a7744ed
|
@ -133,8 +133,8 @@ public final class OneTimeTokenLoginConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
private void configureOttGenerateFilter(H http) {
|
||||
GenerateOneTimeTokenFilter generateFilter = new GenerateOneTimeTokenFilter(getOneTimeTokenService(http));
|
||||
generateFilter.setGeneratedOneTimeTokenHandler(getGeneratedOneTimeTokenHandler(http));
|
||||
GenerateOneTimeTokenFilter generateFilter = new GenerateOneTimeTokenFilter(getOneTimeTokenService(http),
|
||||
getGeneratedOneTimeTokenHandler(http));
|
||||
generateFilter.setRequestMatcher(antMatcher(HttpMethod.POST, this.generateTokenUrl));
|
||||
http.addFilter(postProcess(generateFilter));
|
||||
http.addFilter(DefaultResourcesFilter.css());
|
||||
|
|
|
@ -45,14 +45,16 @@ public final class GenerateOneTimeTokenFilter extends OncePerRequestFilter {
|
|||
|
||||
private final OneTimeTokenService oneTimeTokenService;
|
||||
|
||||
private final GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler;
|
||||
|
||||
private RequestMatcher requestMatcher = antMatcher(HttpMethod.POST, "/ott/generate");
|
||||
|
||||
private GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler = new RedirectGeneratedOneTimeTokenHandler(
|
||||
"/login/ott");
|
||||
|
||||
public GenerateOneTimeTokenFilter(OneTimeTokenService oneTimeTokenService) {
|
||||
public GenerateOneTimeTokenFilter(OneTimeTokenService oneTimeTokenService,
|
||||
GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler) {
|
||||
Assert.notNull(oneTimeTokenService, "oneTimeTokenService cannot be null");
|
||||
Assert.notNull(generatedOneTimeTokenHandler, "generatedOneTimeTokenHandler cannot be null");
|
||||
this.oneTimeTokenService = oneTimeTokenService;
|
||||
this.generatedOneTimeTokenHandler = generatedOneTimeTokenHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,14 +83,4 @@ public final class GenerateOneTimeTokenFilter extends OncePerRequestFilter {
|
|||
this.requestMatcher = requestMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies {@link GeneratedOneTimeTokenHandler} to be used to handle generated
|
||||
* one-time tokens
|
||||
* @param generatedOneTimeTokenHandler
|
||||
*/
|
||||
public void setGeneratedOneTimeTokenHandler(GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler) {
|
||||
Assert.notNull(generatedOneTimeTokenHandler, "generatedOneTimeTokenHandler cannot be null");
|
||||
this.generatedOneTimeTokenHandler = generatedOneTimeTokenHandler;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue