有没有办法在 Firebase 中添加适用于管理员的安全规则? [英] Is there a way to add security rules that apply to admin in Firebase?

查看:25
本文介绍了有没有办法在 Firebase 中添加适用于管理员的安全规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何在 Firebase 中对管理服务器执行的写入执行安全规则?

Does anyone know how to enforce security rules in Firebase on writes performed by the admin server?

例如:

用户详细信息:{".validate" ://一些基于数据库引用的安全规则//}

userDetail: { ".validate" : //some security rule based on database reference// }

我想确保管理服务器的写入遵守此验证规则.我知道可以在服务器本身上设置安全规则,但我想确保数据与数据库中可以被其他服务器实例修改的另一个位置一致.

I want to ensure that a write by admin server adheres to this validation rule. I understand that a security rule can be put in place on the server itself, but I want to ensure that the data is consistent with another location in the database that can be modified by other server instances.

推荐答案

您不能编写适用于具有管理权限访问级别的请求的安全规则——这是服务帐户身份验证的默认设置.然后安全性被完全禁用,包括验证规则.

You cannot write security rules that apply to requests that have an administrative privileges access level – which is the default for service account authentication. Security is completely disabled then, including validation rules.

但这并不意味着您不能检查您的服务器.更改服务器以使用有限权限进行身份验证.在 Node 和 Java 中,关键字都是 databaseAuthVariableOverride.

But this does not mean that you can't have your servers in check. Change the server to authenticate with limited privileges. In both Node and Java, the keyword is databaseAuthVariableOverride.

另请参阅管理 SDK 设置文档.

这篇关于有没有办法在 Firebase 中添加适用于管理员的安全规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆