[英]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: 您的选择:
Setup a proper environment, where APIM is used to authorize users. 设置适当的环境,使用APIM来授权用户。 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的工作方式,而不要强迫其以其他方式工作
If you really must using your own OAuth tokens, you could send the authorization token in different header (which will not get cleared) 如果您确实必须使用自己的OAuth令牌,则可以在其他标头中发送授权令牌(不会清除)
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.