将Firebase安全限制为特定的Google Apps域? [重复]

问题描述 投票:8回答:2

我目前正在寻求将Firebase用于内部应用程序,该内部应用程序只能由拥有我们组织的Google帐户的员工访问。

我理解如何限制只对谷歌登录的读/写访问权限,例如

{
  "rules": {
    ".read": "auth.provider === 'google'",
    ".write": "auth.provider === 'google'"
  }
}

但我无法弄清楚如何限制对Google帐户中特定域/组织的访问。我知道这可以在应用程序级别完成,但考虑到我们用来访问数据库的通道数,我想在数据库级别强制执行auth,以及应用程序级别。

有没有人这样做过?谢谢。

firebase-realtime-database firebase-security
2个回答
11
投票

您可以使用以下命令限制对gmail域的访问:

{
  "rules": {
    ".read": "auth.token.email.endsWith('domain.com')",
    ".write": "auth.token.email.endsWith('domain.com')"
  }
}

1
投票

我也在寻找这个功能,但看起来除非您编写自己的令牌/自定义身份验证,否则此功能不可用。

在未来,Firebase表示他们“认为我们有更好的解决方案。” Read more...

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.