Spring zuul proxy to OAuth2 server password grant

2019-05-19 14:11发布

问题:

I'm trying to implement a Zuul reverse proxy with @EnableOAuth2Sso so I can relay the access tokens obtained from the authentication server to my resource server.

The question is how do I configure the Zuul proxy to forward the username and password to the authentication server, since I am using the password grant flow to obtain the tokens.

回答1:

If the question is still relevant...

I had a task to configure Authorization and Resource servers behind Zuul using password grant type. This article and example on github helped me a lot, but mostly I've used debug to configure the environment.

Please check my example of configuration OAuth2 Password Grant Type behind Zuul.

To run the example, inside every service folder run mnv spring-boot:run

In browser go to http://localhost:8765, credentials user/user, admin/admin

http://localhost:8761/ - eureka

I have not used @EnableOAuth2Sso, but instead @EnableOAuth2Client and configure only ResourceOwnerPasswordAccessTokenProvider (more details here). @EnableOAuth2Sso is configured all token providers, but I need only password provider.

Example uses JwtTokens.



标签: spring proxy