如何为用于身份验证的AWS管理员API启用用户名密码身份验证

时间:2019-12-30 17:22:35

标签: java amazon-web-services api aws-lambda

我正在研究AWS和Cognito,并尝试在AWS Java api的帮助下创建User Pool及其客户端。使用这些api可以成功创建UserPool和App客户端。 但是我想设置两个选项,但在API中找不到任何选项来启用它们。

第一个选项是:启用用户名密码验证...

enter image description here

第二个选项是:认知用户池

enter image description here

以下是创建Appclient的Java代码

private UserPoolClientType createUserPoolAppClient(String userPoolId) {
        CreateUserPoolClientRequest request = new CreateUserPoolClientRequest();
        request.setUserPoolId(userPoolId);
        request.setClientName(userPoolId);
        request.setGenerateSecret(false);
        request.setAllowedOAuthFlowsUserPoolClient(true);

        List<String> callbackURLs = new ArrayList<>();
        callbackURLs.add("http://localhost:8080");
        request.setCallbackURLs(callbackURLs);

        List<String> allowedOAuthFlows = new ArrayList<>();
        allowedOAuthFlows.add("code");
        allowedOAuthFlows.add("implicit");

        request.setAllowedOAuthFlows(allowedOAuthFlows);

        List<String> allowedOAuthScops = new ArrayList<>();
        allowedOAuthScops.add("phone");
        allowedOAuthScops.add("openid");
        allowedOAuthScops.add("aws.cognito.signin.user.admin");

        request.setAllowedOAuthScopes(allowedOAuthScops);
        request.setAllowedOAuthFlowsUserPoolClient(true);

        return getAmazonCognitoIdentityClient().createUserPoolClient(request).getUserPoolClient();
    }

有人可以帮助我使用AWS Java API设置这两个选项的值。

先谢谢了。

0 个答案:

没有答案