gpt4 book ai didi

amazon-cognito - 在 AWS Cognito 中回答 NEW_PASSWORD_REQUIRED 质询后继续自定义身份验证流程

转载 作者:行者123 更新时间:2023-12-03 22:11:12 24 4
gpt4 key购买 nike

新用户由管理员创建。他们需要在首次登录时重置初始密码。我们将 Cognito 应用程序客户端配置为仅允许自定义身份验证流 (CUSTOM_AUTH_FLOW_ONLY)。但是当用户重置他们的密码时,身份验证流程结束,他们立即获得 id-、access- 和 refresh-token,不会发出任何自定义质询。

  • 我如何引导流程以继续我的自定义挑战流程,而不是发行 token ?
  • 如果 token 在重置初始密码后不会在响应中发送,则它也将起作用,因此用户必须再次登录。

  • 一个新用户当前正在运行此流程:
  • 目前,对于新用户,我们发送 InitiateAuthRequest使用用户名和 SRP_A,AuthFlow 设置为 CUSTOM_AUTH ,就像正常登录一样。
  • 我们的 DefineAuthChallengeLambda 被击中,发出 PASSWORD_VERIFIER挑战。
  • 客户端使用 srp 声明、用户名和时间戳来响应身份验证质询。
  • Cognito 验证响应并发现用户必须更改其密码。我们的 lambda 触发器被跳过,NEW_PASSWORD_REQUIRED Cognito 返回挑战。
  • 客户端使用新密码响应身份验证质询,Cognito 接受密码并发出 token ,这不是我们想要的。

  • 我们要么希望流程在这里结束而不发出任何 token ,要么不在这里结束并继续定义身份验证挑战触发器调用。

    最佳答案

    所以我联系了 AWS Support 并得到了以下答复:

    As I mentioned, we've been engaging with the team and it looks like you've identified an issue with using Custom_Auth as well as an issue with using Custom_Auth and Password_Verifier/New_Password_Required challenges. It looks like changing Custom_auth to or from SRP_A and using the New password required challenge does not work at this moment. We managed to replicate this fully with the Cognito Service team and they've confirmed this is a bit broken and we don't have support for these challenges with Custom auth. They agreed however we should support them at base and we've identified this as a feature request with the team and they've placed it on the prioritised list. Unfortunately I can't give a definitive time-frame for this to be implemented fully.



    特尔;博士:
    目前不完全支持带有密码验证的自定义身份验证流程。密码重置挑战打破了流程。

    对我们来说,我们使用了一种解决方法:在 PreTokenGeneration lambda 触发器中,我们检查当前的身份验证流程是否来自密码重置事件。如果是这种情况,我们只会抛出异常并且不会发出任何 token 。异常消息返回给客户端,因此通过检查异常的消息内容,您可以看到究竟发生了什么错误。如果您看到由于密码重置而未生成 token ,只需告诉用户:“密码成功重置”并再次将它们重定向到登录页面。从那里他们可以正常登录,完成整个自定义身份验证流程。

    遗憾的是,当该功能可用时,无法提供任何反馈。显然,大多数新功能都已公布 here ,所以我会密切注意这一点。

    关于amazon-cognito - 在 AWS Cognito 中回答 NEW_PASSWORD_REQUIRED 质询后继续自定义身份验证流程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54327168/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com