Cognito 与 Okta 作为 IdP 使用 SAML 2 更新令牌问题
Cognito with Okta as IdP using SAML 2 Renew token problem
我遇到了 AWS Cognito 的问题,我使用 SAML 协议将 Okta 用作 IdP。
我使用这个文档配置了所有内容https://aws.amazon.com/premiumsupport/knowledge-center/cognito-okta-saml-identity-provider/
在 Okta 有集成的广告,我们从中获得用户。
一切正常,当我向 Cognito 发送令牌请求时,我得到了访问令牌、Id 令牌和令牌类型。之后在 Cognito 用户池中创建具有特定前缀的 "external user",这是保存在 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 使用 "Authorization" 选项卡获取令牌并检查类型为 OAuth 2.0。每个属性都很好,但我不知道为什么每次成功请求令牌后(或当前令牌将过期 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
都想破坏服务,而实际上什么都没有改变。
我遇到了 AWS Cognito 的问题,我使用 SAML 协议将 Okta 用作 IdP。
我使用这个文档配置了所有内容https://aws.amazon.com/premiumsupport/knowledge-center/cognito-okta-saml-identity-provider/
在 Okta 有集成的广告,我们从中获得用户。
一切正常,当我向 Cognito 发送令牌请求时,我得到了访问令牌、Id 令牌和令牌类型。之后在 Cognito 用户池中创建具有特定前缀的 "external user",这是保存在 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 使用 "Authorization" 选项卡获取令牌并检查类型为 OAuth 2.0。每个属性都很好,但我不知道为什么每次成功请求令牌后(或当前令牌将过期 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
都想破坏服务,而实际上什么都没有改变。