org.springframework.security.oauth2.client.token.AccessTokenProviderChain Java Examples
The following examples show how to use
org.springframework.security.oauth2.client.token.AccessTokenProviderChain.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FacebookConfiguration.java From OAuth-2.0-Cookbook with MIT License | 5 votes |
@Bean public OAuth2RestTemplate restTemplate(OAuth2ClientContext context) { OAuth2RestTemplate rest = new OAuth2RestTemplate(resourceDetails(), context); rest.setAccessTokenProvider( new AccessTokenProviderChain( Arrays.asList(new AuthorizationCodeAccessTokenProvider()))); return rest; }
Example #2
Source File: GoogleConfiguration.java From OAuth-2.0-Cookbook with MIT License | 5 votes |
@Bean public OAuth2RestTemplate restTemplate(OAuth2ClientContext context) { OAuth2RestTemplate rest = new OAuth2RestTemplate(resourceDetails(), context); AccessTokenProviderChain providerChain = new AccessTokenProviderChain( Arrays.asList(new AuthorizationCodeAccessTokenProvider())); rest.setAccessTokenProvider(providerChain); return rest; }
Example #3
Source File: GoogleConfiguration.java From OAuth-2.0-Cookbook with MIT License | 5 votes |
@Bean public OAuth2RestTemplate restTemplate(OAuth2ClientContext context) { OAuth2RestTemplate rest = new OAuth2RestTemplate(resourceDetails(), context); AccessTokenProviderChain providerChain = new AccessTokenProviderChain( Arrays.asList(new AuthorizationCodeAccessTokenProvider())); rest.setAccessTokenProvider(providerChain); return rest; }
Example #4
Source File: SmartlingClientConfiguration.java From mojito with Apache License 2.0 | 5 votes |
public OAuth2RestTemplate smartlingRestTemplate() { OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(smartling(), new DefaultOAuth2ClientContext()); RestTemplateUtils restTemplateUtils = new RestTemplateUtils(); restTemplateUtils.enableFeature(oAuth2RestTemplate, DeserializationFeature.UNWRAP_ROOT_VALUE); AccessTokenProviderChain accessTokenProviderChain = new AccessTokenProviderChain(Arrays.asList( new SmartlingAuthorizationCodeAccessTokenProvider()) ); oAuth2RestTemplate.setAccessTokenProvider(accessTokenProviderChain); DefaultUriTemplateHandler defaultUriTemplateHandler = new DefaultUriTemplateHandler(); defaultUriTemplateHandler.setBaseUrl(baseUri); oAuth2RestTemplate.setUriTemplateHandler(defaultUriTemplateHandler); oAuth2RestTemplate.setErrorHandler(new DefaultResponseErrorHandler() { @Override public void handleError(ClientHttpResponse response) throws IOException { try { super.handleError(response); } catch (HttpClientErrorException e) { if (resttemplateLogger.isDebugEnabled()) { resttemplateLogger.debug(e.getResponseBodyAsString()); } throw e; } } }); return oAuth2RestTemplate; }
Example #5
Source File: ClientConfiguration.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public OAuth2RestTemplate oauth2RestTemplate() { OAuth2ProtectedResourceDetails resourceDetails = authorizationCode(); OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); AccessTokenProviderChain provider = new AccessTokenProviderChain( Arrays.asList(new AuthorizationCodeAccessTokenProvider())); provider.setClientTokenServices(clientTokenServices); template.setAccessTokenProvider(provider); return template; }
Example #6
Source File: ClientConfiguration.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public OAuth2RestTemplate oauth2RestTemplate() { OAuth2ProtectedResourceDetails resourceDetails = authorizationCode(); OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); AccessTokenProviderChain provider = new AccessTokenProviderChain( Arrays.asList(new AuthorizationCodeAccessTokenProvider())); provider.setClientTokenServices(clientTokenServices); template.setAccessTokenProvider(provider); return template; }
Example #7
Source File: ClientConfiguration.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public OAuth2RestTemplate oauth2RestTemplate() { OAuth2ProtectedResourceDetails resourceDetails = passwordResourceDetails(); OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); AccessTokenProviderChain provider = new AccessTokenProviderChain( Arrays.asList(new ClientCredentialsAccessTokenProvider())); provider.setClientTokenServices(clientTokenServices); template.setAccessTokenProvider(provider); return template; }
Example #8
Source File: ClientConfiguration.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public OAuth2RestTemplate oauth2RestTemplate() { OAuth2ProtectedResourceDetails resourceDetails = passwordResourceDetails(); OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); AccessTokenProviderChain provider = new AccessTokenProviderChain( Arrays.asList(new ResourceOwnerPasswordAccessTokenProvider())); provider.setClientTokenServices(clientTokenServices); template.setAccessTokenProvider(provider); return template; }
Example #9
Source File: ClientConfiguration.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public OAuth2RestTemplate oauth2RestTemplate() { OAuth2ProtectedResourceDetails resourceDetails = implicitResourceDetails(); OAuth2RestTemplate template = new OAuth2RestTemplate(resourceDetails, oauth2ClientContext); AccessTokenProviderChain provider = new AccessTokenProviderChain( Arrays.asList(new CustomImplicitAccessTokenProvider())); provider.setClientTokenServices(clientTokenServices); template.setAccessTokenProvider(provider); return template; }