Support Custom RequestMatchers for WebAuthn
Closes gh-16517 Signed-off-by: topiam <support@topiam.cn>
This commit is contained in:
@@ -75,6 +75,17 @@ public class PublicKeyCredentialRequestOptionsFilter extends OncePerRequestFilte
|
||||
this.rpOptions = rpOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link RequestMatcher} used to trigger this filter. By default, the
|
||||
* {@link RequestMatcher} is {@code POST /webauthn/authenticate/options}.
|
||||
* @param requestMatcher the {@link RequestMatcher} to use
|
||||
* @since 6.5
|
||||
*/
|
||||
public void setRequestMatcher(RequestMatcher requestMatcher) {
|
||||
Assert.notNull(requestMatcher, "requestMatcher cannot be null");
|
||||
this.matcher = requestMatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -82,6 +82,18 @@ public class PublicKeyCredentialCreationOptionsFilter extends OncePerRequestFilt
|
||||
this.rpOperations = rpOperations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link RequestMatcher} used to trigger this filter.
|
||||
* <p>
|
||||
* By default, the {@link RequestMatcher} is {@code POST /webauthn/register/options}.
|
||||
* @param requestMatcher the {@link RequestMatcher} to use
|
||||
* @since 6.5
|
||||
*/
|
||||
public void setRequestMatcher(RequestMatcher requestMatcher) {
|
||||
Assert.notNull(requestMatcher, "requestMatcher cannot be null");
|
||||
this.matcher = requestMatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -105,6 +105,32 @@ public class WebAuthnRegistrationFilter extends OncePerRequestFilter {
|
||||
this.rpOptions = rpOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link RequestMatcher} to trigger this filter's the credential
|
||||
* registration operation .
|
||||
* <p/>
|
||||
* By default, the {@link RequestMatcher} is {@code POST /webauthn/register}.
|
||||
* @param registerCredentialMatcher the {@link RequestMatcher} to use
|
||||
* @since 6.5
|
||||
*/
|
||||
public void setRegisterCredentialMatcher(RequestMatcher registerCredentialMatcher) {
|
||||
Assert.notNull(registerCredentialMatcher, "registerCredentialMatcher cannot be null");
|
||||
this.registerCredentialMatcher = registerCredentialMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link RequestMatcher} to trigger this filter's the credential removal
|
||||
* operation .
|
||||
* <p/>
|
||||
* By default, the {@link RequestMatcher} is {@code DELETE /webauthn/register/{id}}.
|
||||
* @param removeCredentialMatcher the {@link RequestMatcher} to use
|
||||
* @since 6.5
|
||||
*/
|
||||
public void setRemoveCredentialMatcher(RequestMatcher removeCredentialMatcher) {
|
||||
Assert.notNull(removeCredentialMatcher, "removeCredentialMatcher cannot be null");
|
||||
this.removeCredentialMatcher = removeCredentialMatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
Reference in New Issue
Block a user