Interface AuthenticateCognitoActionProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AuthenticateCognitoActionProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:18.931Z") @Stability(Stable) public interface AuthenticateCognitoActionProps extends software.amazon.jsii.JsiiSerializable
Properties for AuthenticateCognitoAction.

Example:

 import software.amazon.awscdk.services.certificatemanager.*;
 Vpc vpc;
 Certificate certificate;
 ApplicationLoadBalancer lb = ApplicationLoadBalancer.Builder.create(this, "LB")
         .vpc(vpc)
         .internetFacing(true)
         .build();
 UserPool userPool = new UserPool(this, "UserPool");
 UserPoolClient userPoolClient = UserPoolClient.Builder.create(this, "Client")
         .userPool(userPool)
         // Required minimal configuration for use with an ELB
         .generateSecret(true)
         .authFlows(AuthFlow.builder()
                 .userPassword(true)
                 .build())
         .oAuth(OAuthSettings.builder()
                 .flows(OAuthFlows.builder()
                         .authorizationCodeGrant(true)
                         .build())
                 .scopes(List.of(OAuthScope.EMAIL))
                 .callbackUrls(List.of(String.format("https://%s/oauth2/idpresponse", lb.getLoadBalancerDnsName())))
                 .build())
         .build();
 CfnUserPoolClient cfnClient = (CfnUserPoolClient)userPoolClient.getNode().getDefaultChild();
 cfnClient.addPropertyOverride("RefreshTokenValidity", 1);
 cfnClient.addPropertyOverride("SupportedIdentityProviders", List.of("COGNITO"));
 UserPoolDomain userPoolDomain = UserPoolDomain.Builder.create(this, "Domain")
         .userPool(userPool)
         .cognitoDomain(CognitoDomainOptions.builder()
                 .domainPrefix("test-cdk-prefix")
                 .build())
         .build();
 lb.addListener("Listener", BaseApplicationListenerProps.builder()
         .port(443)
         .certificates(List.of(certificate))
         .defaultAction(AuthenticateCognitoAction.Builder.create()
                 .userPool(userPool)
                 .userPoolClient(userPoolClient)
                 .userPoolDomain(userPoolDomain)
                 .next(ListenerAction.fixedResponse(200, FixedResponseOptions.builder()
                         .contentType("text/plain")
                         .messageBody("Authenticated")
                         .build()))
                 .build())
         .build());
 CfnOutput.Builder.create(this, "DNS")
         .value(lb.getLoadBalancerDnsName())
         .build();
 
  • Method Details

    • getNext

      @Stability(Stable) @NotNull ListenerAction getNext()
      What action to execute next.

      Multiple actions form a linked chain; the chain must always terminate in a (weighted)forward, fixedResponse or redirect action.

    • getUserPool

      @Stability(Stable) @NotNull IUserPool getUserPool()
      The Amazon Cognito user pool.
    • getUserPoolClient

      @Stability(Stable) @NotNull IUserPoolClient getUserPoolClient()
      The Amazon Cognito user pool client.
    • getUserPoolDomain

      @Stability(Stable) @NotNull IUserPoolDomain getUserPoolDomain()
      The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
    • getAllowHttpsOutbound

      @Stability(Stable) @Nullable default Boolean getAllowHttpsOutbound()
      Allow HTTPS outbound traffic to communicate with the IdP.

      Set this property to false if the IP address used for the IdP endpoint is identifiable and you want to control outbound traffic. Then allow HTTPS outbound traffic to the IdP's IP address using the listener's connections property.

      Default: true

      See Also:
    • getAuthenticationRequestExtraParams

      @Stability(Stable) @Nullable default Map<String,String> getAuthenticationRequestExtraParams()
      The query parameters (up to 10) to include in the redirect request to the authorization endpoint.

      Default: - No extra parameters

    • getOnUnauthenticatedRequest

      @Stability(Stable) @Nullable default UnauthenticatedAction getOnUnauthenticatedRequest()
      The behavior if the user is not authenticated.

      Default: UnauthenticatedAction.AUTHENTICATE

    • getScope

      @Stability(Stable) @Nullable default String getScope()
      The set of user claims to be requested from the IdP.

      To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.

      Default: "openid"

    • getSessionCookieName

      @Stability(Stable) @Nullable default String getSessionCookieName()
      The name of the cookie used to maintain session information.

      Default: "AWSELBAuthSessionCookie"

    • getSessionTimeout

      @Stability(Stable) @Nullable default Duration getSessionTimeout()
      The maximum duration of the authentication session.

      Default: Duration.days(7)

    • builder

      @Stability(Stable) static AuthenticateCognitoActionProps.Builder builder()
      Returns:
      a AuthenticateCognitoActionProps.Builder of AuthenticateCognitoActionProps