简体   繁体   English

使用 WSO2 Identity Server 和 WSO2 API Manager 保护后端

[英]Securing backend with WSO2 Identity Server and WSO2 API Manager

I have an API that is exposed through WSO2 API Manager, it is secured by OAuth2 so client must pass an apikey , token or credentials in order to get access to resources.我有一个 API 通过 WSO2 API Manager 公开,它由 OAuth2 保护,因此客户端必须传递apikeytokencredentials才能访问资源。 So far so good.到目前为止,一切都很好。 But now, I'd like to protect backend's endpoint as well.但现在,我也想保护后端的端点。 Backend only accepts calls from API Manager (IP security) but it is open, I mean, if someone with access to APIM's host does the call, it will accept since there is no authentication between them.后端仅接受来自 API Manager(IP 安全)的调用,但它是开放的,我的意思是,如果有权访问 APIM 主机的人进行调用,它将接受,因为它们之间没有身份验证。

I would like to use Identity Server to protect backend but according to APIM documentation , supported endpoint security are BASIC or DIGEST.我想使用 Identity Server 来保护后端,但根据APIM 文档,支持的端点安全性是 BASIC 或 DIGEST。

What is the best approach to implement BASIC/Digest auth in SpringBoot backend and use WSO2 Identity Server as user registry?在 SpringBoot 后端实现 BASIC/Digest 身份验证并使用 WSO2 身份服务器作为用户注册表的最佳方法是什么? This way I can centralize every security details to a single solution.这样我就可以将每个安全细节集中到一个解决方案中。

Thanks in advance.提前致谢。

If you use basic auth or any such, your back end might have to do another API call to WSO2 to validate that token.如果您使用基本身份验证或任何此类身份验证,您的后端可能必须再次调用 API 到 WSO2 来验证该令牌。 Instead, you can pass a self contained JWT token from the API manager to the backend.相反,您可以将自包含的 JWT 令牌从 API 管理器传递到后端。 So that the back end can validate that the JWT is issued by the API manager it self using using the certificate without relying on anything else.这样后端就可以验证 JWT 是由它自己使用证书的 API 经理颁发的,而不依赖于任何其他东西。

From this way you can verify if the call was made y API Manager, additionally the end user as well from the JWT content.通过这种方式,您可以验证是否调用了 API 经理,以及最终用户以及 JWT 的内容。

Doc: https://apim.docs.wso2.com/en/latest/learn/api-gateway/passing-end-user-attributes-to-the-backend/passing-enduser-attributes-to-the-backend-using-jwt/?fbclid=IwAR1JT9DLOclmA-xw0Ev9C2Xrje5EDGrDBnmMkfDKMcbxTlCLf0swSPucMfA文档: https://apim.docs.wso2.com/en/latest/learn/api-gateway/passing-end-user-attributes-to-the-backend/passing-enduser-attributes-to-the-backend-使用-jwt/?fbclid=IwAR1JT9DLOclmA-xw0Ev9C2Xrje5EDGrDBnmMkfDKMcbxTlCLf0swSPucMfA

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM