Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

How to get a client_credentials token for doing behind the scenes calls #54

Open
leon opened this issue Apr 1, 2015 · 6 comments
Open

Comments

@leon
Copy link
Contributor

leon commented Apr 1, 2015

If I inject the the bean registered as oAuth2RestTemplate it will pass on the user token.

If I want to pass on a client_credential would it be correct to do this?

@Bean
@ConfigurationProperties("spring.oauth2.client")
public ClientCredentialsResourceDetails oauth2ClientCredentialsResourceDetails() {
    ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
    return details;
}

@Bean
public OAuth2RestTemplate clientCredentialsRestTemplate(OAuth2ClientContext oauth2ClientContext, ClientCredentialsResourceDetails details) {
    OAuth2RestTemplate template = new OAuth2RestTemplate(details, oauth2ClientContext);
    return template;
}

Maybe we should add a section in the docs about machine to machine communication and how to do that with feign or with RestTemplate?

@dsyer
Copy link
Contributor

dsyer commented Apr 1, 2015

Sounds like a plan. See also #51.

@jjparsons
Copy link

@dsyer I would also like to use use OAuth2 for backend requests such as requests to the config server and service register (Eureka). What is the best approach to ensure client credentials are used within the discovery client and config client?

@geercode
Copy link

I sincerely hope you guys fix this problem.I just want to secure my spring cloud application.Did it get fixed?

@dsyer
Copy link
Contributor

dsyer commented Dec 27, 2017

It's not a problem is it? Just a documentation request. What do you mean? How would you "fix" it?

@spencergibb
Copy link
Contributor

ping @jerryniu

@geercode
Copy link

geercode commented Aug 29, 2018

Easy,guys.Last time I check this was at version D.When I use thread strategy,It cant pass client credentials in the header.I was not looking into it for a detail.No offence. @dsyer @spencergibb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants