spring-cloud-security
spring-cloud-security copied to clipboard
How to get a client_credentials token for doing behind the scenes calls
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?
Sounds like a plan. See also #51.
@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?
I sincerely hope you guys fix this problem.I just want to secure my spring cloud application.Did it get fixed?
It's not a problem is it? Just a documentation request. What do you mean? How would you "fix" it?
ping @JerryNiu
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