简体   繁体   English

WSO2 API管理器安全层

[英]WSO2 API manager security layer

I hope to use wso2 api manager to expose my webservices to a mobile app.I want to store an api key in the localstorage of the client and use it along with the api calls for the authentication. 我希望使用wso2 api管理器将我的Web服务公开给移动应用程序。我想将api密钥存储在客户端的本地存储中,并将其与api调用一起用于身份验证。 So how can I pass the automatically generated api key by the wso2 api manager for each web service and pass it to the client? 那么,如何通过wso2 api管理器为每个Web服务传递自动生成的api密钥,并将其传递给客户端? Are there any alternatives for this? 有其他选择吗?

You can achieve your requirement using the 'jaggery' APIs WSO2 API Manager provides. 您可以使用WSO2 API管理器提供的“ jaggery” API来满足您的要求。

'jaggey' is basically a server side java script language developed by WSO2 itself. “ jaggey”基本上是WSO2本身开发的服务器端Java脚本语言。 The WSO2 API Manager's API Store and API Publisher web applications are powered using 'jaggery' . WSO2 API Manager的API Store和API Publisher Web应用程序使用'jaggery'驱动 The syntax of jaggery is much like java script but its functionality is more like JSP since it executes in the server. Jaggery的语法非常类似于Java脚本,但是其功能更类似于JSP,因为它在服务器中执行。 All the API Manager back-end functionality is exposed as jaggery APIs. 所有API Manager后端功能都以粗俗的 API形式公开。 However currently there is no documentation on these APIs. 但是,目前没有关于这些API的文档。

I would suggest you to download the WSO2 API Manager source code [1] and look at the following files to get a better understanding of how you can achieve this. 我建议您下载WSO2 API Manager源代码[1]并查看以下文件,以更好地了解如何实现此目的。 In order to generate the application keys from a client application you need to invoke HTTP requests to a certain jaggery page [2]. 为了从客户端应用程序生成的应用程序键,您需要调用HTTP请求到一定的粗糖页面[2]。 As an example, how this invocation happens in the API Store application can be found at [3]. 例如,可以在[3]中找到在API Store应用程序中如何进行此调用。 You will have to send a similar HTTP request to get the same response as in the API Store. 您将必须发送类似的HTTP请求,以获得与API Store中相同的响应。 Before generating keys the client will also have to login. 在生成密钥之前,客户端还必须登录。 For this you need to send an HTTP request to [4]. 为此,您需要将HTTP请求发送到[4]。 How this invocation happens in the API Store application can be found at [5]. 在[5]中可以找到API Store应用程序中这种调用的方式。

[1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/apimgt [1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/apimgt

[2] apimgt/api-store-web/src/site/blocks/subscription/subscription-add/ajax/subscription-add.jag [2] apimgt / api-store-web / src / site / blocks / subscription / subscription-add / ajax / subscription-add.jag

[3] apimgt/api-store-web/src/site/themes/fancy/templates/subscription/subscription-list/js/subscription-list.js [3] apimgt / api-store-web / src / site / themes / fancy / templates / subscription / subscription-list / js / subscription-list.js

[4] apimgt/api-store-web/src/site/themes/fancy/templates/user/login/js/login.js [4] apimgt / api-store-web / src / site / themes / fancy / templates / user / login / js / login.js

[5] apimgt/api-store-web/src/site/blocks/user/login/ajax/login.jag [5] apimgt / api-store-web / src / site / blocks / user / login / ajax / login.jag

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

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