@Test public void doFilter_with_unmatched_url_test() throws IOException, ServletException { AssertionOptionsProvider optionsProvider = mock(AssertionOptionsProvider.class); AssertionOptionsEndpointFilter optionsEndpointFilter = new AssertionOptionsEndpointFilter(optionsProvider, objectConverter); AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl(); optionsEndpointFilter.setTrustResolver(trustResolver); MockHttpServletRequest request = new MockHttpServletRequest(); request.setRequestURI("/unmatched_url"); MockHttpServletResponse response = new MockHttpServletResponse(); MockFilterChain filterChain = new MockFilterChain(); optionsEndpointFilter.doFilter(request, response, filterChain); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return; } try { PublicKeyCredentialRequestOptions assertionOptions = assertionOptionsProvider.getAssertionOptions(fi.getRequest(), getAuthentication()); writeResponse(fi.getResponse(), assertionOptions); } catch (RuntimeException e) { logger.debug(e); writeErrorResponse(fi.getResponse(), e); } }
AssertionOptionsEndpointFilter extends AbstractOptionsEndpointFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return; } try { PublicKeyCredentialRequestOptions assertionOptions = assertionOptionsProvider.getAssertionOptions(fi.getRequest(), getAuthentication()); writeResponse(fi.getResponse(), assertionOptions); } catch (RuntimeException e) { logger.debug(e); writeErrorResponse(fi.getResponse(), e); } } }
AssertionOptionsEndpointFilter extends AbstractOptionsEndpointFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return; } try { PublicKeyCredentialRequestOptions assertionOptions = assertionOptionsProvider.getAssertionOptions(fi.getRequest(), getAuthentication()); writeResponse(fi.getResponse(), assertionOptions); } catch (RuntimeException e) { logger.debug(e); writeErrorResponse(fi.getResponse(), e); } } AssertionOptionsEndpointFilter(AssertionOptionsProvider assertionOptionsProvider, ObjectConverter objectConverter); }
AssertionOptionsEndpointFilter extends AbstractOptionsEndpointFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return; } try { PublicKeyCredentialRequestOptions assertionOptions = assertionOptionsProvider.getAssertionOptions(fi.getRequest(), getAuthentication()); writeResponse(fi.getResponse(), assertionOptions); } catch (RuntimeException e) { logger.debug(e); writeErrorResponse(fi.getResponse(), e); } } AssertionOptionsEndpointFilter(AssertionOptionsProvider assertionOptionsProvider, ObjectConverter objectConverter); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); }
AssertionOptionsEndpointFilter extends AbstractOptionsEndpointFilter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return; } try { PublicKeyCredentialRequestOptions assertionOptions = assertionOptionsProvider.getAssertionOptions(fi.getRequest(), getAuthentication()); writeResponse(fi.getResponse(), assertionOptions); } catch (RuntimeException e) { logger.debug(e); writeErrorResponse(fi.getResponse(), e); } } AssertionOptionsEndpointFilter(AssertionOptionsProvider assertionOptionsProvider, ObjectConverter objectConverter); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); static final String FILTER_URL; }