简体   繁体   English

通过WSO2 API管理器访问oauth2安全服务

[英]Accessing a oauth2 secured service via WSO2 API Manager

我有一个项目,其中有多个使用Spring oauth2保护的微服务。我已经在WSO2 API Manager上发布了这些服务,并禁用了WSO2的oauth2功能,因为我的服务已经使用Spring oauth2保护了。在WSO2上,使用spring oauth2的令牌,我得到响应,或者状态代码0为“无响应”,或者状态代码为403未经授权。这里可能是问题所在。

The WSO2AM (API Manager) authorizes the clients using the OAuth protocol and the backend services should trust the WSO2AM providing service authorization. WSO2AM(API管理器)使用OAuth协议授权客户端,后端服务应信任提供服务授权的WSO2AM。

The API MAnager is not able (by default) validate the tokens of your backend services. API MAnager无法(默认情况下)验证后端服务的令牌。

As far I know WSO2 AM clears the "Authorization" header to the backend services. 据我所知,WSO2 AM清除了后端服务的“授权”标头。 (correct me when I am wrong). (如果我做错了,请纠正我)。

your options: 您的选择:

  1. Setup a proper environment, where APIM is used to authorize users. 设置适当的环境,使用API​​M来授权用户。 The APIM can send a JWT token to the backend services with user identity and attributes and the backend service will validate and trust the APIM JWT token containing user identity and attributes. APIM可以将JWT令牌发送给具有用户身份和属性的后端服务,后端服务将验证并信任包含用户身份和属性的APIM JWT令牌。 I really suggest you stick to the way how APIM works and not try to force it working other way 我真的建议您坚持APIM的工作方式,而不要强迫其以其他方式工作

  2. If you really must using your own OAuth tokens, you could send the authorization token in different header (which will not get cleared) 如果您确实必须使用自己的OAuth令牌,则可以在其他标头中发送授权令牌(不会清除)

  3. You could create a custom mediation flow to to re-enter the authorization header into the request (I am not sure if you will need to update the exposed api mediation flow too or not to skip the default authorizer). 您可以创建一个自定义中介流,以将授权标头重新输入到请求中(我不确定您是否也需要更新公开的api中介流,还是不需要跳过默认授权者)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring rest service api call from oauth2 secured rest web service - Spring rest service api call from oauth2 secured rest web service Spring 引导客户端调用 REST API 由 OAuth2 保护 - Spring boot Client to invoke REST API secured by OAuth2 使用Postman访问受Spring Boot 2和OAuth 2保护的REST API - Accessing REST API secured with Spring Boot 2 and OAuth 2 using Postman Spring Security 5 在 Application Runner 中调用 OAuth2 Secured API 导致 IllegalArgumentException - Spring Security 5 Calling OAuth2 Secured API in Application Runner results in IllegalArgumentException Spring OAuth2 授权服务器,带有使用基本身份验证保护的 Actuator 端点 - Spring OAuth2 Authorization Server with Actuator endpoints secured with basic auth 使用oauth2在浏览器中登录后访问REST服务,并使用java config访问spring security - Accessing REST service after login within browser using oauth2 and spring security using java config Spring Security OAuth2正确的授权管理器 - Spring Security OAuth2 correct Authorization Manager Spring OAuth2自定义身份验证管理器ClassCastException - Spring OAuth2 Custom Authentication Manager ClassCastException OAuth 2.0 使用 Spring Security + WSO2 身份服务器 - OAuth 2.0 using Spring Security + WSO2 Identity Server 如果下游服务以401响应,如何在Zuul API网关中触发OAuth2身份验证 - How to trigger OAuth2 authentication in Zuul API gateway if a downstream service responds with a 401
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM