Search in sources :

Example 1 with OAuth2AuthenticationEntryPoint

use of org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint in project spring-security-oauth by spring-projects.

the class AuthorizationServerSecurityConfigurer method clientCredentialsTokenEndpointFilter.

private ClientCredentialsTokenEndpointFilter clientCredentialsTokenEndpointFilter(HttpSecurity http) {
    ClientCredentialsTokenEndpointFilter clientCredentialsTokenEndpointFilter = new ClientCredentialsTokenEndpointFilter(frameworkEndpointHandlerMapping().getServletPath("/oauth/token"));
    clientCredentialsTokenEndpointFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
    OAuth2AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint();
    authenticationEntryPoint.setTypeName("Form");
    authenticationEntryPoint.setRealmName(realm);
    clientCredentialsTokenEndpointFilter.setAuthenticationEntryPoint(authenticationEntryPoint);
    clientCredentialsTokenEndpointFilter = postProcess(clientCredentialsTokenEndpointFilter);
    http.addFilterBefore(clientCredentialsTokenEndpointFilter, BasicAuthenticationFilter.class);
    return clientCredentialsTokenEndpointFilter;
}
Also used : AuthenticationManager(org.springframework.security.authentication.AuthenticationManager) ClientCredentialsTokenEndpointFilter(org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter) OAuth2AuthenticationEntryPoint(org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint)

Aggregations

AuthenticationManager (org.springframework.security.authentication.AuthenticationManager)1 ClientCredentialsTokenEndpointFilter (org.springframework.security.oauth2.provider.client.ClientCredentialsTokenEndpointFilter)1 OAuth2AuthenticationEntryPoint (org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint)1