All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.elasticloadbalancingv2.model.AuthenticateCognitoActionConfig Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Elastic Load Balancing module holds the client classes that are used for communicating with Elastic Load Balancing Service (API Version 2015-12-01)

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.elasticloadbalancingv2.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Request parameters to use when integrating with Amazon Cognito to authenticate users. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AuthenticateCognitoActionConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField USER_POOL_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::userPoolArn)).setter(setter(Builder::userPoolArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserPoolArn").build()).build(); private static final SdkField USER_POOL_CLIENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::userPoolClientId)).setter(setter(Builder::userPoolClientId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserPoolClientId").build()).build(); private static final SdkField USER_POOL_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::userPoolDomain)).setter(setter(Builder::userPoolDomain)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserPoolDomain").build()).build(); private static final SdkField SESSION_COOKIE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::sessionCookieName)).setter(setter(Builder::sessionCookieName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SessionCookieName").build()).build(); private static final SdkField SCOPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::scope)).setter(setter(Builder::scope)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Scope").build()).build(); private static final SdkField SESSION_TIMEOUT_FIELD = SdkField. builder(MarshallingType.LONG) .getter(getter(AuthenticateCognitoActionConfig::sessionTimeout)).setter(setter(Builder::sessionTimeout)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SessionTimeout").build()).build(); private static final SdkField> AUTHENTICATION_REQUEST_EXTRA_PARAMS_FIELD = SdkField .> builder(MarshallingType.MAP) .getter(getter(AuthenticateCognitoActionConfig::authenticationRequestExtraParams)) .setter(setter(Builder::authenticationRequestExtraParams)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthenticationRequestExtraParams") .build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField ON_UNAUTHENTICATED_REQUEST_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AuthenticateCognitoActionConfig::onUnauthenticatedRequestAsString)) .setter(setter(Builder::onUnauthenticatedRequest)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnUnauthenticatedRequest").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(USER_POOL_ARN_FIELD, USER_POOL_CLIENT_ID_FIELD, USER_POOL_DOMAIN_FIELD, SESSION_COOKIE_NAME_FIELD, SCOPE_FIELD, SESSION_TIMEOUT_FIELD, AUTHENTICATION_REQUEST_EXTRA_PARAMS_FIELD, ON_UNAUTHENTICATED_REQUEST_FIELD)); private static final long serialVersionUID = 1L; private final String userPoolArn; private final String userPoolClientId; private final String userPoolDomain; private final String sessionCookieName; private final String scope; private final Long sessionTimeout; private final Map authenticationRequestExtraParams; private final String onUnauthenticatedRequest; private AuthenticateCognitoActionConfig(BuilderImpl builder) { this.userPoolArn = builder.userPoolArn; this.userPoolClientId = builder.userPoolClientId; this.userPoolDomain = builder.userPoolDomain; this.sessionCookieName = builder.sessionCookieName; this.scope = builder.scope; this.sessionTimeout = builder.sessionTimeout; this.authenticationRequestExtraParams = builder.authenticationRequestExtraParams; this.onUnauthenticatedRequest = builder.onUnauthenticatedRequest; } /** *

* The Amazon Resource Name (ARN) of the Amazon Cognito user pool. *

* * @return The Amazon Resource Name (ARN) of the Amazon Cognito user pool. */ public String userPoolArn() { return userPoolArn; } /** *

* The ID of the Amazon Cognito user pool client. *

* * @return The ID of the Amazon Cognito user pool client. */ public String userPoolClientId() { return userPoolClientId; } /** *

* The domain prefix or fully-qualified domain name of the Amazon Cognito user pool. *

* * @return The domain prefix or fully-qualified domain name of the Amazon Cognito user pool. */ public String userPoolDomain() { return userPoolDomain; } /** *

* The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie. *

* * @return The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie. */ public String sessionCookieName() { return sessionCookieName; } /** *

* The set of user claims to be requested from the IdP. The default is openid. *

*

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

* * @return The set of user claims to be requested from the IdP. The default is openid.

*

* To verify which scope values your IdP supports and how to separate multiple values, see the documentation * for your IdP. */ public String scope() { return scope; } /** *

* The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days). *

* * @return The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days). */ public Long sessionTimeout() { return sessionTimeout; } /** * Returns true if the AuthenticationRequestExtraParams property was specified by the sender (it may be empty), or * false if the sender did not specify the value (it will be empty). For responses returned by the SDK, the sender * is the AWS service. */ public boolean hasAuthenticationRequestExtraParams() { return authenticationRequestExtraParams != null && !(authenticationRequestExtraParams instanceof SdkAutoConstructMap); } /** *

* The query parameters (up to 10) to include in the redirect request to the authorization endpoint. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasAuthenticationRequestExtraParams()} to see if a value was sent in this field. *

* * @return The query parameters (up to 10) to include in the redirect request to the authorization endpoint. */ public Map authenticationRequestExtraParams() { return authenticationRequestExtraParams; } /** *

* The behavior if the user is not authenticated. The following are possible values: *

*
    *
  • *

    * deny - Return an HTTP 401 Unauthorized error. *

    *
  • *
  • *

    * allow - Allow the request to be forwarded to the target. *

    *
  • *
  • *

    * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, * {@link #onUnauthenticatedRequest} will return * {@link AuthenticateCognitoActionConditionalBehaviorEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the * service is available from {@link #onUnauthenticatedRequestAsString}. *

* * @return The behavior if the user is not authenticated. The following are possible values:

*
    *
  • *

    * deny - Return an HTTP 401 Unauthorized error. *

    *
  • *
  • *

    * allow - Allow the request to be forwarded to the target. *

    *
  • *
  • *

    * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

    *
  • * @see AuthenticateCognitoActionConditionalBehaviorEnum */ public AuthenticateCognitoActionConditionalBehaviorEnum onUnauthenticatedRequest() { return AuthenticateCognitoActionConditionalBehaviorEnum.fromValue(onUnauthenticatedRequest); } /** *

    * The behavior if the user is not authenticated. The following are possible values: *

    *
      *
    • *

      * deny - Return an HTTP 401 Unauthorized error. *

      *
    • *
    • *

      * allow - Allow the request to be forwarded to the target. *

      *
    • *
    • *

      * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, * {@link #onUnauthenticatedRequest} will return * {@link AuthenticateCognitoActionConditionalBehaviorEnum#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the * service is available from {@link #onUnauthenticatedRequestAsString}. *

    * * @return The behavior if the user is not authenticated. The following are possible values:

    *
      *
    • *

      * deny - Return an HTTP 401 Unauthorized error. *

      *
    • *
    • *

      * allow - Allow the request to be forwarded to the target. *

      *
    • *
    • *

      * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

      *
    • * @see AuthenticateCognitoActionConditionalBehaviorEnum */ public String onUnauthenticatedRequestAsString() { return onUnauthenticatedRequest; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(userPoolArn()); hashCode = 31 * hashCode + Objects.hashCode(userPoolClientId()); hashCode = 31 * hashCode + Objects.hashCode(userPoolDomain()); hashCode = 31 * hashCode + Objects.hashCode(sessionCookieName()); hashCode = 31 * hashCode + Objects.hashCode(scope()); hashCode = 31 * hashCode + Objects.hashCode(sessionTimeout()); hashCode = 31 * hashCode + Objects.hashCode(authenticationRequestExtraParams()); hashCode = 31 * hashCode + Objects.hashCode(onUnauthenticatedRequestAsString()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AuthenticateCognitoActionConfig)) { return false; } AuthenticateCognitoActionConfig other = (AuthenticateCognitoActionConfig) obj; return Objects.equals(userPoolArn(), other.userPoolArn()) && Objects.equals(userPoolClientId(), other.userPoolClientId()) && Objects.equals(userPoolDomain(), other.userPoolDomain()) && Objects.equals(sessionCookieName(), other.sessionCookieName()) && Objects.equals(scope(), other.scope()) && Objects.equals(sessionTimeout(), other.sessionTimeout()) && Objects.equals(authenticationRequestExtraParams(), other.authenticationRequestExtraParams()) && Objects.equals(onUnauthenticatedRequestAsString(), other.onUnauthenticatedRequestAsString()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("AuthenticateCognitoActionConfig").add("UserPoolArn", userPoolArn()) .add("UserPoolClientId", userPoolClientId()).add("UserPoolDomain", userPoolDomain()) .add("SessionCookieName", sessionCookieName()).add("Scope", scope()).add("SessionTimeout", sessionTimeout()) .add("AuthenticationRequestExtraParams", authenticationRequestExtraParams()) .add("OnUnauthenticatedRequest", onUnauthenticatedRequestAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "UserPoolArn": return Optional.ofNullable(clazz.cast(userPoolArn())); case "UserPoolClientId": return Optional.ofNullable(clazz.cast(userPoolClientId())); case "UserPoolDomain": return Optional.ofNullable(clazz.cast(userPoolDomain())); case "SessionCookieName": return Optional.ofNullable(clazz.cast(sessionCookieName())); case "Scope": return Optional.ofNullable(clazz.cast(scope())); case "SessionTimeout": return Optional.ofNullable(clazz.cast(sessionTimeout())); case "AuthenticationRequestExtraParams": return Optional.ofNullable(clazz.cast(authenticationRequestExtraParams())); case "OnUnauthenticatedRequest": return Optional.ofNullable(clazz.cast(onUnauthenticatedRequestAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AuthenticateCognitoActionConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The Amazon Resource Name (ARN) of the Amazon Cognito user pool. *

      * * @param userPoolArn * The Amazon Resource Name (ARN) of the Amazon Cognito user pool. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userPoolArn(String userPoolArn); /** *

      * The ID of the Amazon Cognito user pool client. *

      * * @param userPoolClientId * The ID of the Amazon Cognito user pool client. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userPoolClientId(String userPoolClientId); /** *

      * The domain prefix or fully-qualified domain name of the Amazon Cognito user pool. *

      * * @param userPoolDomain * The domain prefix or fully-qualified domain name of the Amazon Cognito user pool. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userPoolDomain(String userPoolDomain); /** *

      * The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie. *

      * * @param sessionCookieName * The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sessionCookieName(String sessionCookieName); /** *

      * The set of user claims to be requested from the IdP. The default is openid. *

      *

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

      * * @param scope * The set of user claims to be requested from the IdP. The default is openid.

      *

      * To verify which scope values your IdP supports and how to separate multiple values, see the * documentation for your IdP. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scope(String scope); /** *

      * The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days). *

      * * @param sessionTimeout * The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 * days). * @return Returns a reference to this object so that method calls can be chained together. */ Builder sessionTimeout(Long sessionTimeout); /** *

      * The query parameters (up to 10) to include in the redirect request to the authorization endpoint. *

      * * @param authenticationRequestExtraParams * The query parameters (up to 10) to include in the redirect request to the authorization endpoint. * @return Returns a reference to this object so that method calls can be chained together. */ Builder authenticationRequestExtraParams(Map authenticationRequestExtraParams); /** *

      * The behavior if the user is not authenticated. The following are possible values: *

      *
        *
      • *

        * deny - Return an HTTP 401 Unauthorized error. *

        *
      • *
      • *

        * allow - Allow the request to be forwarded to the target. *

        *
      • *
      • *

        * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

        *
      • *
      * * @param onUnauthenticatedRequest * The behavior if the user is not authenticated. The following are possible values:

      *
        *
      • *

        * deny - Return an HTTP 401 Unauthorized error. *

        *
      • *
      • *

        * allow - Allow the request to be forwarded to the target. *

        *
      • *
      • *

        * authenticate * - Redirect the request to the IdP authorization endpoint. This is the default value. *

        *
      • * @see AuthenticateCognitoActionConditionalBehaviorEnum * @return Returns a reference to this object so that method calls can be chained together. * @see AuthenticateCognitoActionConditionalBehaviorEnum */ Builder onUnauthenticatedRequest(String onUnauthenticatedRequest); /** *

        * The behavior if the user is not authenticated. The following are possible values: *

        *
          *
        • *

          * deny - Return an HTTP 401 Unauthorized error. *

          *
        • *
        • *

          * allow - Allow the request to be forwarded to the target. *

          *
        • *
        • *

          * authenticate - Redirect the request to the IdP authorization endpoint. This is the default value. *

          *
        • *
        * * @param onUnauthenticatedRequest * The behavior if the user is not authenticated. The following are possible values:

        *
          *
        • *

          * deny - Return an HTTP 401 Unauthorized error. *

          *
        • *
        • *

          * allow - Allow the request to be forwarded to the target. *

          *
        • *
        • *

          * authenticate * - Redirect the request to the IdP authorization endpoint. This is the default value. *

          *
        • * @see AuthenticateCognitoActionConditionalBehaviorEnum * @return Returns a reference to this object so that method calls can be chained together. * @see AuthenticateCognitoActionConditionalBehaviorEnum */ Builder onUnauthenticatedRequest(AuthenticateCognitoActionConditionalBehaviorEnum onUnauthenticatedRequest); } static final class BuilderImpl implements Builder { private String userPoolArn; private String userPoolClientId; private String userPoolDomain; private String sessionCookieName; private String scope; private Long sessionTimeout; private Map authenticationRequestExtraParams = DefaultSdkAutoConstructMap.getInstance(); private String onUnauthenticatedRequest; private BuilderImpl() { } private BuilderImpl(AuthenticateCognitoActionConfig model) { userPoolArn(model.userPoolArn); userPoolClientId(model.userPoolClientId); userPoolDomain(model.userPoolDomain); sessionCookieName(model.sessionCookieName); scope(model.scope); sessionTimeout(model.sessionTimeout); authenticationRequestExtraParams(model.authenticationRequestExtraParams); onUnauthenticatedRequest(model.onUnauthenticatedRequest); } public final String getUserPoolArn() { return userPoolArn; } @Override public final Builder userPoolArn(String userPoolArn) { this.userPoolArn = userPoolArn; return this; } public final void setUserPoolArn(String userPoolArn) { this.userPoolArn = userPoolArn; } public final String getUserPoolClientId() { return userPoolClientId; } @Override public final Builder userPoolClientId(String userPoolClientId) { this.userPoolClientId = userPoolClientId; return this; } public final void setUserPoolClientId(String userPoolClientId) { this.userPoolClientId = userPoolClientId; } public final String getUserPoolDomain() { return userPoolDomain; } @Override public final Builder userPoolDomain(String userPoolDomain) { this.userPoolDomain = userPoolDomain; return this; } public final void setUserPoolDomain(String userPoolDomain) { this.userPoolDomain = userPoolDomain; } public final String getSessionCookieName() { return sessionCookieName; } @Override public final Builder sessionCookieName(String sessionCookieName) { this.sessionCookieName = sessionCookieName; return this; } public final void setSessionCookieName(String sessionCookieName) { this.sessionCookieName = sessionCookieName; } public final String getScope() { return scope; } @Override public final Builder scope(String scope) { this.scope = scope; return this; } public final void setScope(String scope) { this.scope = scope; } public final Long getSessionTimeout() { return sessionTimeout; } @Override public final Builder sessionTimeout(Long sessionTimeout) { this.sessionTimeout = sessionTimeout; return this; } public final void setSessionTimeout(Long sessionTimeout) { this.sessionTimeout = sessionTimeout; } public final Map getAuthenticationRequestExtraParams() { return authenticationRequestExtraParams; } @Override public final Builder authenticationRequestExtraParams(Map authenticationRequestExtraParams) { this.authenticationRequestExtraParams = AuthenticateCognitoActionAuthenticationRequestExtraParamsCopier .copy(authenticationRequestExtraParams); return this; } public final void setAuthenticationRequestExtraParams(Map authenticationRequestExtraParams) { this.authenticationRequestExtraParams = AuthenticateCognitoActionAuthenticationRequestExtraParamsCopier .copy(authenticationRequestExtraParams); } public final String getOnUnauthenticatedRequestAsString() { return onUnauthenticatedRequest; } @Override public final Builder onUnauthenticatedRequest(String onUnauthenticatedRequest) { this.onUnauthenticatedRequest = onUnauthenticatedRequest; return this; } @Override public final Builder onUnauthenticatedRequest(AuthenticateCognitoActionConditionalBehaviorEnum onUnauthenticatedRequest) { this.onUnauthenticatedRequest(onUnauthenticatedRequest == null ? null : onUnauthenticatedRequest.toString()); return this; } public final void setOnUnauthenticatedRequest(String onUnauthenticatedRequest) { this.onUnauthenticatedRequest = onUnauthenticatedRequest; } @Override public AuthenticateCognitoActionConfig build() { return new AuthenticateCognitoActionConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }