【问题标题】:AWS Cognito: Restrict users to a single domainAWS Cognito:将用户限制在单个域中
【发布时间】:2016-12-06 07:05:30
【问题描述】:

我使用 cognito 联合登录和 google 作为身份提供者。要求是只允许我公司的用户(域为 xxx@mycompany.com)。

任何关于如何以及在何处配置此类规则的想法将不胜感激。或者请指点我正确的文档。

谢谢你,

【问题讨论】:

    标签: amazon-web-services amazon-cognito


    【解决方案1】:

    我可以通过 pre-signup lambda trigger 实现这一点,但找不到仅使用配置来限制访问的方法。

    这是我的 lambda 函数代码

    exports.handler = (event, context, callback) => {
        console.log ("Trigger function =", event.triggerSource);
    
        // Send post authentication data to Cloudwatch logs
        if (event.request.userAttributes.email.endsWith('@mydomain.com')) {
                console.log ("Authentication successful: ", event.request);
                callback(null, event);
        } else {
            console.log ("Authentication failed: ", event.request);
            callback("can't connect to admin", event)
        }
    
    };
    

    【讨论】:

      【解决方案2】:

      您可以合理地将此验证构建到在用户注册/登录流程中触发的lambda hooks 之一。

      【讨论】:

        【解决方案3】:

        Lambda 触发器仅适用于 Cognito 用户池,不适用于 Cognito 身份池。

        此问题已在此处得到解答:Restrict login to Enterprise Google Domain for AWS Federated Identity Pool

        【讨论】:

          猜你喜欢
          • 2019-11-25
          • 1970-01-01
          • 2017-12-03
          • 1970-01-01
          • 1970-01-01
          • 2018-01-31
          • 1970-01-01
          • 2018-07-10
          • 2018-11-17
          相关资源
          最近更新 更多