org.springframework.security.oauth2.client.token.AccessTokenProvider Java Examples

The following examples show how to use org.springframework.security.oauth2.client.token.AccessTokenProvider. 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: MyOAuth2RestTemplate.java    From springboot-security-wechat with Apache License 2.0 6 votes vote down vote up
public MyOAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context) {
    super(resource, context);
    this.accessTokenProvider = new MyAccessTokenProviderChain(Arrays.asList(new AccessTokenProvider[]{new MyAuthorizationCodeAccessTokenProvider(),
            new ImplicitAccessTokenProvider(),
            new ResourceOwnerPasswordAccessTokenProvider(),
            new ClientCredentialsAccessTokenProvider()}));
    this.retryBadAccessTokens = true;
    this.authenticator = new DefaultOAuth2RequestAuthenticator();
    if(resource == null) {
        throw new IllegalArgumentException("An OAuth2 resource must be supplied.");
    } else {
        this.resource = resource;
        this.context = context;
        this.setErrorHandler(new OAuth2ErrorHandler(resource));
    }
}
 
Example #2
Source File: MyAccessTokenProviderChain.java    From springboot-security-wechat with Apache License 2.0 4 votes vote down vote up
public MyAccessTokenProviderChain(List<? extends AccessTokenProvider> chain) {
    this.chain = chain == null? Collections.emptyList():Collections.unmodifiableList(chain);
}
 
Example #3
Source File: ManualOAuthAuthenticationProvider.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
public AccessTokenProvider userAccessTokenProvider() {
	ResourceOwnerPasswordAccessTokenProvider accessTokenProvider = new ResourceOwnerPasswordAccessTokenProvider();
	return accessTokenProvider;
}
 
Example #4
Source File: OAuth2FeignRequestInterceptor.java    From spring-cloud-security with Apache License 2.0 4 votes vote down vote up
public void setAccessTokenProvider(AccessTokenProvider accessTokenProvider) {
	this.accessTokenProvider = accessTokenProvider;
}