简体   繁体   中英

How do we use spring security + Oauth2 client credentials for Service to Service ( fetch Auth token followed by resources)

sorry if this feels a little over worded question. I have aa endpoint which provides Auth Bearer token, using which i can fetch resources from another endpoint ( same domain though). I already have the client credentials ID/secret.

I wanted to see some sample code of how this is configured using Service to Service without a UI for logging in pls.

I read that RestTemplate and OauthRestTempate is deprecated and we should be using Web client ( https://docs.spring.io/spring-security/site/docs/current/reference/html5/#oauth2Client-webclient-servlet )

but I am bit a confused on how this is actually implemented. I wanted to see the format for the application.yml file format, because i understand the format varies depending on what grant type we use. also is there a mongodb spring jar that i can Autowire, so that i can move the resources that i get to the db directly please.

This could be a good start for your case!

Take a look also at the different flow types in OpenId Connect.

Spring Boot + OAuth 2 Client Credentials Grant - Hello World Example

https://www.javainuse.com/spring/springboot-oauth2-client-grant

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM