Spring zuul 代理到 OAuth2 服务器密码授予 [英] Spring zuul proxy to OAuth2 server password grant

查看:56
本文介绍了Spring zuul 代理到 OAuth2 服务器密码授予的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 @EnableOAuth2Sso 实现 Zuul 反向代理,以便我可以将从身份验证服务器获得的访问令牌中继到我的资源服务器.

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.

问题是我如何配置 Zuul 代理以将用户名和密码转发到身份验证服务器,因为我使用密码授予流程来获取令牌.

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.

推荐答案

如果问题仍然相关...

If the question is still relevant...

我有一项任务是使用密码授予类型在 Zuul 后面配置授权和资源服务器.这个 文章github 上的示例 后面的负载平衡对我帮助很大,但主要是我使用调试来配置环境.

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.

请检查我的后面的配置OAuth2密码授予类型示例祖尔.

要运行示例,在每个服务文件夹中运行 mnv spring-boot:run

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

在浏览器中转到 http://localhost:8765,凭据用户/用户,管理员/管理员

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

http://localhost:8761/ - 尤里卡

我没有使用 @EnableOAuth2Sso,而是使用 @EnableOAuth2Client 并且只配置了 ResourceOwnerPasswordAccessTokenProvider (更多细节在这里).@EnableOAuth2Sso 配置了所有令牌提供者,但我只需要密码提供者.

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.

示例使用 JwtToken.

Example uses JwtTokens.

这篇关于Spring zuul 代理到 OAuth2 服务器密码授予的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆