简体   繁体   English

身份验证和安全环回API

[英]Authentication and Secure Loopback APIs

I created a loopback api (' http://localhost:8100/api/insertsubmitorder/insertOrders ') . 我创建了一个回送api(' http:// localhost:8100 / api / insertsubmitorder / insertOrders ')。 this api is not Secure . 此api不安全。 Can we Secure and Authenticate this API using OAuth2 or Other . 我们可以使用OAuth2或“其他”来保护和认证此API吗? I go through the looback docs for Authentication http://loopback.io/doc/en/lb3/Authentication-authorization-and-permissions.html#preparing-access-control-models . 我浏览了身份验证http://loopback.io/doc/en/lb3/Authentication-authorization-and-permissions.html#preparing-access-control-models的回溯文档。

but i can not get the soluition. 但我无法获得解决方案。 Please tell me how can i add Security my loopback APIs. 请告诉我如何添加安全性回送API。

If you have a user-database with already existing users, I'd suggest writing a custom login with LoopBacks built in user-functionality. 如果您的用户数据库已有用户,则建议使用内置于用户功能的LoopBacks编写自定义登录。 Otherwise, just create a user and do a login-post to the /login-endpoint. 否则,只需创建一个用户并在/ login-endpoint上登录即可。 This will return an accesstoken (and also the user object if you wish to include it) which you can use against the endpoints for validation. 这将返回一个访问令牌(如果希望包含它,还返回用户对象),您可以将其用于端点进行验证。 The validation is setup through the ACL in the models json-objects. 验证是通过模型json-objects中的ACL设置的。

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

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