我正在尝试将 Cognito - 用户池 - 应用程序客户端中的身份验证流程设置为 AWS CDK 中的以下流程。
我只能让它添加这些流程。
我缺少 ALLOW_ADMIN_USER_PASSWORD_AUTH。
我创建应用程序客户端的代码如下。
cognito.CfnUserPoolClientProps(
user_pool_id=self.user_pool.user_pool_id,
explicit_auth_flows=["ALLOW_ADMIN_USER_PASSWORD_AUTH, ALLOW_CUSTOM_AUTH, ALLOW_REFRESH_TOKEN_AUTH, ALLOW_USER_SRP_AUTH"]
)
self.user_pool.add_client('cognito-app-client',
user_pool_client_name='cognito-app-client',
access_token_validity=Duration.minutes(60),
id_token_validity=Duration.minutes(60),
refresh_token_validity=Duration.days(1),
# auth_flows=cognito.AuthFlow(user_password=True),
o_auth=cognito.OAuthSettings(
flows=cognito.OAuthFlows(
implicit_code_grant=True,
)
),
prevent_user_existence_errors=True,
generate_secret=True,
enable_token_revocation=True)
有人能指出我正确的方向吗?
更新-我显然把这件事复杂化了。 :-)
[https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_cognito/AuthFlow.html][1]
self.user_pool.add_client('poc-cognito-app-client',
user_pool_client_name='poc-cognito-app-client',
access_token_validity=Duration.minutes(60),
id_token_validity=Duration.minutes(60),
refresh_token_validity=Duration.days(1),
auth_flows=cognito.AuthFlow(admin_user_password=True, user_srp=True, custom=True),
o_auth=cognito.OAuthSettings(
flows=cognito.OAuthFlows(
implicit_code_grant=True
)
),
# scopes=aws_cdk.aws_cognito.OAuthScope.resource_server(aws_cdk.aws_cognito.OAuthScope.OPENID, aws_cdk.aws_cognito.OAuthScope.resource_server(resource_server, nested-stack_api_read_scope))),
prevent_user_existence_errors=True,
generate_secret=True,
enable_token_revocation=True)