use of org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager in project spring-security-oauth by spring-projects.
the class ResourceServerSecurityConfigurer method oauthAuthenticationManager.
private AuthenticationManager oauthAuthenticationManager(HttpSecurity http) {
OAuth2AuthenticationManager oauthAuthenticationManager = new OAuth2AuthenticationManager();
if (authenticationManager != null) {
if (authenticationManager instanceof OAuth2AuthenticationManager) {
oauthAuthenticationManager = (OAuth2AuthenticationManager) authenticationManager;
} else {
return authenticationManager;
}
}
oauthAuthenticationManager.setResourceId(resourceId);
oauthAuthenticationManager.setTokenServices(resourceTokenServices(http));
oauthAuthenticationManager.setClientDetailsService(clientDetails());
return oauthAuthenticationManager;
}
use of org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager in project coffeenet-starter by coffeenet.
the class IntegrationCoffeeNetWebSecurityConfigurerAdapter method apiTokenAccessFilter.
/**
* This filter should be used in the {@link org.springframework.security.web.SecurityFilterChain} to allow
* stateless authentication with a bearer token in the Authorization-Header of a Request. If this Filter is not
* used authentication is only possible with an active session.
*/
private Filter apiTokenAccessFilter() {
OAuth2AuthenticationProcessingFilter apiTokenAccessFilter = new OAuth2AuthenticationProcessingFilter();
apiTokenAccessFilter.setStateless(false);
OAuth2AuthenticationManager oauthAuthenticationManager = new OAuth2AuthenticationManager();
oauthAuthenticationManager.setResourceId(coffeenetResource.getResourceId());
oauthAuthenticationManager.setTokenServices(userInfoTokenServices);
oauthAuthenticationManager.setClientDetailsService(null);
apiTokenAccessFilter.setAuthenticationManager(oauthAuthenticationManager);
return apiTokenAccessFilter;
}
use of org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager in project coffeenet-starter by coffeenet.
the class CoffeeNetApiTokenAccessFilter method oauthAuthenticationManager.
private AuthenticationManager oauthAuthenticationManager(ResourceServerTokenServices tokenServices) {
OAuth2AuthenticationManager oauthAuthenticationManager = new OAuth2AuthenticationManager();
oauthAuthenticationManager.setResourceId(resourceServerProperties.getResourceId());
oauthAuthenticationManager.setTokenServices(tokenServices);
oauthAuthenticationManager.setClientDetailsService(null);
return oauthAuthenticationManager;
}
Aggregations