【问题标题】:Restricting Firebase security to a specific Google Apps domain? [duplicate]将 Firebase 安全性限制为特定的 Google Apps 域? [复制]
【发布时间】:2015-10-28 18:25:11
【问题描述】:

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

我了解如何将读/写访问权限限制为仅限谷歌登录,例如

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

但我不知道如何限制对 Google 帐户中特定域/组织的访问。我知道这可以在应用程序级别完成,但考虑到我们用于访问数据库的通道数量,我想在应用程序级别之外在数据库级别强制执行身份验证。

以前有人做过吗?谢谢。

【问题讨论】:

    标签: firebase-realtime-database firebase-security


    【解决方案1】:

    您可以通过以下方式限制对您的 gmail 域的访问:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2015-01-15
        • 1970-01-01
        • 2018-03-18
        • 2021-10-18
        • 2018-06-12
        • 2019-04-24
        • 1970-01-01
        • 1970-01-01
        • 2021-01-04
        相关资源
        最近更新 更多