use of org.springframework.security.oauth2.provider.token.RemoteTokenServices in project spring-boot by spring-projects.
the class ResourceServerTokenServicesConfigurationTests method useRemoteTokenServices.
@Test
public void useRemoteTokenServices() {
EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.resource.tokenInfoUri:http://example.com", "security.oauth2.resource.clientId=acme");
this.context = new SpringApplicationBuilder(ResourceConfiguration.class).environment(this.environment).web(WebApplicationType.NONE).run();
RemoteTokenServices services = this.context.getBean(RemoteTokenServices.class);
assertThat(services).isNotNull();
}
use of org.springframework.security.oauth2.provider.token.RemoteTokenServices in project openlmis-stockmanagement by OpenLMIS.
the class ResourceServerSecurityConfiguration method remoteTokenServices.
/**
* RemoteTokenServices bean initializer.
*
* @param checkTokenUrl url to check tokens against
* @param clientId client's id
* @param clientSecret client's secret
* @return token services
*/
@Bean
@Autowired
public RemoteTokenServices remoteTokenServices(@Value("${auth.server.url}") String checkTokenUrl, @Value("${auth.server.clientId}") String clientId, @Value("${auth.server.clientSecret}") String clientSecret) {
final RemoteTokenServices remoteTokenServices = new RemoteTokenServices();
remoteTokenServices.setCheckTokenEndpointUrl(checkTokenUrl);
remoteTokenServices.setClientId(clientId);
remoteTokenServices.setClientSecret(clientSecret);
remoteTokenServices.setAccessTokenConverter(accessTokenConverter());
return remoteTokenServices;
}
use of org.springframework.security.oauth2.provider.token.RemoteTokenServices in project cloud-sea-towerman by huadahuang1983.
the class WebSecurityConfig method remoteTokenServices.
@Bean
public RemoteTokenServices remoteTokenServices() {
RemoteTokenServices services = new RemoteTokenServices();
services.setCheckTokenEndpointUrl(this.resource.getTokenInfoUri());
services.setClientId(this.resource.getClientId());
services.setClientSecret(this.resource.getClientSecret());
DefaultUserAuthenticationConverter userTokenConverter = new DefaultUserAuthenticationConverter();
userTokenConverter.setUserDetailsService(userDetailsService());
DefaultAccessTokenConverter tokenConverter = new DefaultAccessTokenConverter();
tokenConverter.setUserTokenConverter(userTokenConverter);
services.setAccessTokenConverter(tokenConverter);
return services;
}
Aggregations