Java Code Examples for org.springframework.security.authentication.AuthenticationTrustResolverImpl

The following examples show how to use org.springframework.security.authentication.AuthenticationTrustResolverImpl. These examples are extracted from open source projects. 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
@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
@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
@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
public OptionsEndpointFilter(OptionsProvider optionsProvider, ObjectConverter objectConverter) {
    this.optionsProvider = optionsProvider;
    this.jsonConverter = objectConverter.getJsonConverter();
    this.trustResolver = new AuthenticationTrustResolverImpl();
    checkConfig();
}
 
Example 5
@Bean
public AuthenticationTrustResolver authenticationTrustResolver() {
    return new AuthenticationTrustResolverImpl();
}
 
Example 6
@Bean
public AuthenticationTrustResolver authenticationTrustResolver() {
    return new AuthenticationTrustResolverImpl();
}