org.springframework.security.authentication.AuthenticationTrustResolverImpl Java Examples

The following examples show how to use org.springframework.security.authentication.AuthenticationTrustResolverImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OptionsEndpointFilterTest.java    From webauthn4j-spring-security with Apache License 2.0 6 votes vote down vote up
@Test
public void doFilter_test() throws IOException, ServletException {
    OptionsProvider optionsProvider = mock(OptionsProvider.class);
    AttestationOptions attestationOptions = new AttestationOptions(null, null, null, null, null, Collections.emptyList(), null);
    when(optionsProvider.getAttestationOptions(any(), any(), any())).thenReturn(attestationOptions);
    AssertionOptions assertionOptions = new AssertionOptions(null, null, null, null, null, null);
    when(optionsProvider.getAssertionOptions(any(), any(), any())).thenReturn(assertionOptions);
    OptionsEndpointFilter optionsEndpointFilter = new OptionsEndpointFilter(optionsProvider, objectConverter);
    AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
    optionsEndpointFilter.setTrustResolver(trustResolver);

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI(OptionsEndpointFilter.FILTER_URL);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockFilterChain filterChain = new MockFilterChain();

    optionsEndpointFilter.doFilter(request, response, filterChain);
    assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
}
 
Example #2
Source File: OptionsEndpointFilterTest.java    From webauthn4j-spring-security with Apache License 2.0 6 votes vote down vote up
@Test
public void doFilter_with_error_test() throws IOException, ServletException {
    OptionsProvider optionsProvider = mock(OptionsProvider.class);
    doThrow(new RuntimeException()).when(optionsProvider).getAttestationOptions(any(), any(), any());
    OptionsEndpointFilter optionsEndpointFilter = new OptionsEndpointFilter(optionsProvider, objectConverter);
    AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
    optionsEndpointFilter.setTrustResolver(trustResolver);

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI(OptionsEndpointFilter.FILTER_URL);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockFilterChain filterChain = new MockFilterChain();

    optionsEndpointFilter.doFilter(request, response, filterChain);
    assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
 
Example #3
Source File: OptionsEndpointFilterTest.java    From webauthn4j-spring-security with Apache License 2.0 5 votes vote down vote up
@Test
public void getter_setter_test() {
    OptionsEndpointFilter optionsEndpointFilter = new OptionsEndpointFilter(mock(OptionsProvider.class), objectConverter);
    AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
    optionsEndpointFilter.setTrustResolver(trustResolver);
    assertThat(optionsEndpointFilter.getTrustResolver()).isEqualTo(trustResolver);
}
 
Example #4
Source File: OptionsEndpointFilter.java    From webauthn4j-spring-security with Apache License 2.0 4 votes vote down vote up
public OptionsEndpointFilter(OptionsProvider optionsProvider, ObjectConverter objectConverter) {
    this.optionsProvider = optionsProvider;
    this.jsonConverter = objectConverter.getJsonConverter();
    this.trustResolver = new AuthenticationTrustResolverImpl();
    checkConfig();
}
 
Example #5
Source File: WebSecurityBeanConfig.java    From webauthn4j-spring-security with Apache License 2.0 4 votes vote down vote up
@Bean
public AuthenticationTrustResolver authenticationTrustResolver() {
    return new AuthenticationTrustResolverImpl();
}
 
Example #6
Source File: WebSecurityBeanConfig.java    From webauthn4j-spring-security with Apache License 2.0 4 votes vote down vote up
@Bean
public AuthenticationTrustResolver authenticationTrustResolver() {
    return new AuthenticationTrustResolverImpl();
}