use of org.springframework.security.authentication.ProviderManager in project spring-security-oauth by spring-projects.
the class AuthorizationServerEndpointsConfigurer method addUserDetailsService.
private void addUserDetailsService(DefaultTokenServices tokenServices, UserDetailsService userDetailsService) {
if (userDetailsService != null) {
PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
provider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken>(userDetailsService));
tokenServices.setAuthenticationManager(new ProviderManager(Arrays.<AuthenticationProvider>asList(provider)));
}
}
use of org.springframework.security.authentication.ProviderManager in project spring-boot by spring-projects.
the class ManagementWebSecurityAutoConfigurationTests method getUser.
private UserDetails getUser() {
ProviderManager parent = (ProviderManager) this.context.getBean(AuthenticationManager.class);
DaoAuthenticationProvider provider = (DaoAuthenticationProvider) parent.getProviders().get(0);
UserDetailsService service = (UserDetailsService) ReflectionTestUtils.getField(provider, "userDetailsService");
UserDetails user = service.loadUserByUsername("user");
return user;
}
Aggregations