Search in sources :

Example 1 with AuthenticationManagerResolver

use of org.springframework.security.authentication.AuthenticationManagerResolver in project spring-security by spring-projects.

the class OAuth2ResourceServerConfigurer method configure.

@Override
public void configure(H http) {
    BearerTokenResolver bearerTokenResolver = getBearerTokenResolver();
    this.requestMatcher.setBearerTokenResolver(bearerTokenResolver);
    AuthenticationManagerResolver resolver = this.authenticationManagerResolver;
    if (resolver == null) {
        AuthenticationManager authenticationManager = getAuthenticationManager(http);
        resolver = (request) -> authenticationManager;
    }
    BearerTokenAuthenticationFilter filter = new BearerTokenAuthenticationFilter(resolver);
    filter.setBearerTokenResolver(bearerTokenResolver);
    filter.setAuthenticationEntryPoint(this.authenticationEntryPoint);
    filter = postProcess(filter);
    http.addFilter(filter);
}
Also used : AuthenticationManager(org.springframework.security.authentication.AuthenticationManager) AuthenticationManagerResolver(org.springframework.security.authentication.AuthenticationManagerResolver) BearerTokenAuthenticationFilter(org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter) DefaultBearerTokenResolver(org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver) BearerTokenResolver(org.springframework.security.oauth2.server.resource.web.BearerTokenResolver)

Aggregations

AuthenticationManager (org.springframework.security.authentication.AuthenticationManager)1 AuthenticationManagerResolver (org.springframework.security.authentication.AuthenticationManagerResolver)1 BearerTokenAuthenticationFilter (org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter)1 BearerTokenResolver (org.springframework.security.oauth2.server.resource.web.BearerTokenResolver)1 DefaultBearerTokenResolver (org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver)1