首页 \ 问答 \ wso2 api manager如何保护后端apis(wso2 api manager how to protect backend apis)

wso2 api manager如何保护后端apis(wso2 api manager how to protect backend apis)

我正在转向WSO2 API Manager云。 我自己在AWS中托管了我的后端API和wso2 API Manager。 对后端API的访问仅限于WSO2 API Manager EC2 Mahcine的IP。 这样每个请求都必须经过WSO2 Machine。

如何在使用WSO2 Cloud时实现同样的目标?保护我的后端API的理想方式是什么? 或者是否有推荐的方法来保护后端API? 可能会检查后端代码中的某个标记以查看是否通过WSO2 API Mananger发出请求?


I am moving to WSO2 API Manager cloud. I have hosted my backend API's and wso2 API Manager in AWS myself. The access to backend API's were limited only to WSO2 API Manager EC2 Mahcine's IP. So that every request will have to go through WSO2 Machine.

How to achieve the same when using WSO2 Cloud?What is the ideal way to protect my Back End API's? OR is there a recommended approach for protecting backend API's? May be check for some token in the backend code to see if request comes via WSO2 API Mananger?


原文:https://stackoverflow.com/questions/47761739
更新时间:2022-06-08 09:06

最满意答案

正如文档所说, 它是驾驶员的特殊能力 。 它会自动cursor[0]转换为cursor.toArray()[0] 。 您可以通过使用print函数覆盖toArray()或使用new Error().stack来证明它,以获得callstack。 这里是:

at DBQuery.a.toArray ((shell):1:32)
at DBQuery.arrayAccess (src/mongo/shell/query.js:290:17)
at (shell):1:2

如您所见,索引调用arrayAccess 。 怎么样? 这里我们有一个dbQueryIndexAccess函数 ,它调用arrayAccess

v8::Handle<v8::Value> arrayAccess = info.This()->GetPrototype()->ToObject()->Get(
                v8::String::New("arrayAccess"));
...
v8::Handle<v8::Function> f = arrayAccess.As<v8::Function>();
...
return f->Call(info.This(), 1, argv);

这里我们有一个代码 ,它为这个函数设置了索引属性处理程序 。 WOW,v8 API让我们能够添加这个处理程序!

DBQueryFT()->InstanceTemplate()->SetIndexedPropertyHandler(dbQueryIndexAccess);

...并将其注入到JS游标类中,该游标类最初是在JS中定义的。

injectV8Function("DBQuery", DBQueryFT(), _global);

Tl; dr :它是用mongo shell的C ++源代码攻击的


As documentation says, it is special ability of driver. It automagicly converts cursor[0] to cursor.toArray()[0]. You can prove it by overriding toArray() with print function or new Error().stack to get callstack back. Here it is:

at DBQuery.a.toArray ((shell):1:32)
at DBQuery.arrayAccess (src/mongo/shell/query.js:290:17)
at (shell):1:2

As you can see, indexing calls arrayAccess. How? Here we have a dbQueryIndexAccess function, which calls arrayAccess.

v8::Handle<v8::Value> arrayAccess = info.This()->GetPrototype()->ToObject()->Get(
                v8::String::New("arrayAccess"));
...
v8::Handle<v8::Function> f = arrayAccess.As<v8::Function>();
...
return f->Call(info.This(), 1, argv);

And here we have a code, which sets indexed property handler to this function. WOW, v8 API gives us ability to add this handler!

DBQueryFT()->InstanceTemplate()->SetIndexedPropertyHandler(dbQueryIndexAccess);

... and injects it into JS cursor class, which is defined originaly in JS.

injectV8Function("DBQuery", DBQueryFT(), _global);

Tl;dr: It is hacked in C++ source code of mongo shell.

相关问答

更多
  • 该功能已在版本4.12(最新的atm)中添加,并且尚未真正记录。 默认情况下, eachAsync以并发1运行,但您可以在参数“parallel”中更改它。 ( 如此处所示 ) 因此,您的代码看起来像这样: const playerProfileCursor = PlayerProfile.find({}, { tag: 1 }).cursor({ batchSize: 5000 }) const p2 = new Promise>((resolve, reject) => { ...
  • 是的,您可以使用以下查询轻松查看您的字段是否已编入索引: db.collection.stats().indexSizes().c2_YOUR_FIELD_NAME 在上面的查询中,使用您自己的集合名称和字段名称。 如果它在控制台上返回某个值,则该字段将被编入索引。 这将给你很多深刻的知识 Yes, you can easily view whether you field is indexed or not using below query: db.collection.stats().index ...
  • 在PHP中,用于对Mongodb集合进行排序的语法是 // Sort on field x, ascending $cursor->sort(array('x' => 1)); 您的代码可以修改为: - static function simpleSelect($key, $value, $collection) { $con = \Core\Model\Mongo::getConnect(); $query = new \MongoDB\Driver\Query( a ...
  • 没有索引的MongoDB查询将进行表扫描,我们应该知道mongodb的数据大小与mysql相比要多得多。 我猜这可能是进行全扫描时缓慢的问题之一。 关于带索引的查询,mongoDB可能因为缓存而变得更快,没有复杂的查询优化器计划(如mysql)等。 集合的大小不是问题。 实际上,一个集合中可以轻松处理1000万个。 如果您需要归档数据,那么您可以分成较小的集合,这将使过程变得简单。 MongoDB queries without the index will be doing table scan and ...
  • 好吧,基本上MongoDB直接从100个批量读取数据文件(可以用batch_size更改为最大16MB,基本上返回是单个BSON文档)。 这与写出静态结果集的SQL形成对比。 因此,您立即了解游标,如果它们具有与它们交错的操作,则可以返回文档,如果它们在排序中发生更改,即如果您有此查询: db.c.find().sort({s:1}); 其中s是一个整数,由此你修改了第一个找到最高s文档,使它出现在后面,你实际上可以(通过最后一批)再次获得该文档。 当然,这是一个很大的问题。 在某些情况下,您最终可能会绕 ...
  • 不,在这种情况下不会使用索引。 您可以运行explain()来验证。 No, an index won't be used in that case. You can run an explain() to verify.
  • 你必须在这样的嵌套字段上创建索引 db.index.createIndex({ “id.pid.f1”:1, “id.pid.f2”:1}) you have to create index on nested fields like this db.index.createIndex({"id.pid.f1":1,"id.pid.f2":1})
  • 正如文档所说, 它是驾驶员的特殊能力 。 它会自动将cursor[0]转换为cursor.toArray()[0] 。 您可以通过使用print函数覆盖toArray()或使用new Error().stack来证明它,以获得callstack。 这里是: at DBQuery.a.toArray ((shell):1:32) at DBQuery.arrayAccess (src/mongo/shell/query.js:290:17) at (shell):1:2 如您所见,索引调用arrayAcce ...
  • 就MongoDB索引而言,您可以考虑几种不同的方法。 多键索引 索引名称和变体的常用方法是基于搜索项数组实现多键搜索(如您所见)。 MongoDB手册中还有一个示例: 支持关键字搜索的模型数据 。 使用此方法,您可以索引多个相关关键字以进行搜索,并控制其他关键字。 索引字通常以小写形式存储,具有常见变体,因此您不必使用正则表达式匹配。 如果正则表达式区分大小写并且在匹配字符串的开头有一个锚(^),则正则表达式匹配只能有效地使用索引。 MongoDB 2.4文本搜索 MongoDB 2.4引入了一个新的文本搜 ...
  • MongoDB不支持检索索引的内容,以获取索引文档的详细信息。 但是,您可以使用与索引中的过滤器相同的过滤器对集合运行查询,以获取索引文档: db.collection.find({ "IsArchived": { "$eq": true } }) 另外,如果你想获得计数,你可以在最后加上.count() : db.collection.find({ "IsArchived": { "$eq": true } }).count() 为了查看您的索引是否被使用,您可以运行以下查询: db.collecti ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)