Spring zuul proxy to OAuth2 server password grant

2019-05-19 14:02发布

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.

标签: spring proxy
1条回答
一夜七次
2楼-- · 2019-05-19 14:08

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.

查看更多
登录 后发表回答