【问题标题】:Cognito with Okta as IdP using SAML 2 Renew token problem使用 SAML 2 更新令牌问题的 Okta 作为 IdP 的 Cognito
【发布时间】:2020-05-04 08:04:35
【问题描述】:

我遇到了 AWS Cognito 的问题,我使用 Okta 作为 IdP,使用 SAML 协议。

我使用这个文档 https://aws.amazon.com/premiumsupport/knowledge-center/cognito-okta-saml-identity-provider/ 配置了所有内容

在 Okta 有集成的广告,我们可以从中获取用户。 一切正常,当我向 Cognito 发送令牌请求时,我得到了访问令牌和 Id 令牌和令牌类型。之后在 Cognito 用户池中创建具有特定前缀的“外部用户”,该前缀是保存在 Cognito 中的 IdP 的名称。 当我删除每个 cookie 并尝试使用与以前相同的凭据再次发送请求令牌时引起的问题。 在这一步之后,我每次都会出错 Error: server_error: {"error_description":"Error+in+SAML+response+processing:+Invalid+user+attributes:+email:+Attribute+cannot+be+updated.+","error":"server_error"}

我使用 Postman 使用“授权”选项卡获取令牌,并将类型检查为 OAuth 2.0。每个属性都很好,但我不知道为什么在第一次成功请求令牌后(或当前令牌过期 1 小时后)每次都会出现该错误。

【问题讨论】:

    标签: amazon-cognito saml-2.0 okta


    【解决方案1】:

    好的,大概我找到了解决方案。 当我从 AWS UI 创建 Cognito 时,一切正常。虽然从 Terraform 创建 Cognito 后有些东西不起作用,但所有设置和属性都与手动创建的 Cognito 相同。

    我改变的是另一种将架构添加到 Cognito 用户池的方法

    schema = {
      attribute_data_type = "String",
      name = "email",
      required = true
    }
    

    到这里

      schema {
        attribute_data_type      = "String"
        developer_only_attribute = false
        mutable                  = true
        name                     = "email"
        required                 = true
    
        string_attribute_constraints {
          min_length = 7
          max_length = 256
        }
      }
    

    我认为mutable 属性很重要。如果没有这个属性,terraform 会认为这个服务的状态是变化的,每个tf apply 都想销毁实际上没有任何变化的服务。

    【讨论】:

      猜你喜欢
      • 2023-02-16
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 2021-09-04
      相关资源
      最近更新 更多