我正在运行 Parse Server 的干净 Heroku 和 MLab 安装(https://github.com/ParsePlatform/parse-server-example https://github.com/ParsePlatform/parse-server-example),我使用 Parse Server 仪表板(https://github.com/ParsePlatform/parse-dashboard https://github.com/ParsePlatform/parse-dashboard).
我可以进行 Rest API 调用并创建新类。如何防止通过 API 调用(通过登录用户或匿名)创建新类?
目前在 Parse Server Dashboard 中似乎无法对此进行控制。
我在这里找到了我的问题的答案:
http://stansidel.com/2016/03/parse-server-security-considerations-and-server-updates/ http://stansidel.com/2016/03/parse-server-security-considerations-and-server-updates/
设置允许创建客户端类这是解析服务器设置中的高级选项之一。
我已经设定启用匿名用户设置为 false 可防止匿名调用 API。
index.js 中的相关代码片段现在如下所示:
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
enableAnonymousUsers: process.env.ANON_USERS || false,
allowClientClassCreation: process.env.CLIENT_CLASS_CREATION || false,
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)