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

software.amazon.awssdk.services.cognitoidentityprovider.model.InitiateAuthRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Cognito Identity Provider Service module holds the client classes that are used for communicating with Amazon Cognito Identity Provider Service.

There is a newer version: 2.30.1
Show newest version
/*
 * Copyright 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.cognitoidentityprovider.model;

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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;

/**
 * 

* Initiates the authentication request. *

*/ @Generated("software.amazon.awssdk:codegen") public final class InitiateAuthRequest extends CognitoIdentityProviderRequest implements ToCopyableBuilder { private static final SdkField AUTH_FLOW_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AuthFlow").getter(getter(InitiateAuthRequest::authFlowAsString)).setter(setter(Builder::authFlow)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthFlow").build()).build(); private static final SdkField> AUTH_PARAMETERS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("AuthParameters") .getter(getter(InitiateAuthRequest::authParameters)) .setter(setter(Builder::authParameters)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthParameters").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> CLIENT_METADATA_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("ClientMetadata") .getter(getter(InitiateAuthRequest::clientMetadata)) .setter(setter(Builder::clientMetadata)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientMetadata").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 CLIENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ClientId").getter(getter(InitiateAuthRequest::clientId)).setter(setter(Builder::clientId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientId").build()).build(); private static final SdkField ANALYTICS_METADATA_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("AnalyticsMetadata") .getter(getter(InitiateAuthRequest::analyticsMetadata)).setter(setter(Builder::analyticsMetadata)) .constructor(AnalyticsMetadataType::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnalyticsMetadata").build()).build(); private static final SdkField USER_CONTEXT_DATA_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("UserContextData") .getter(getter(InitiateAuthRequest::userContextData)).setter(setter(Builder::userContextData)) .constructor(UserContextDataType::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserContextData").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTH_FLOW_FIELD, AUTH_PARAMETERS_FIELD, CLIENT_METADATA_FIELD, CLIENT_ID_FIELD, ANALYTICS_METADATA_FIELD, USER_CONTEXT_DATA_FIELD)); private final String authFlow; private final Map authParameters; private final Map clientMetadata; private final String clientId; private final AnalyticsMetadataType analyticsMetadata; private final UserContextDataType userContextData; private InitiateAuthRequest(BuilderImpl builder) { super(builder); this.authFlow = builder.authFlow; this.authParameters = builder.authParameters; this.clientMetadata = builder.clientMetadata; this.clientId = builder.clientId; this.analyticsMetadata = builder.analyticsMetadata; this.userContextData = builder.userContextData; } /** *

* The authentication flow for this call to run. The API action will depend on this value. For example: *

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP variables to * be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next * challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access token * and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. If a * user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find the user * name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. *

*

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

* * @return The authentication flow for this call to run. The API action will depend on this value. For example:

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the * next challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access * token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. * If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't * find the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. * @see AuthFlowType */ public final AuthFlowType authFlow() { return AuthFlowType.fromValue(authFlow); } /** *

* The authentication flow for this call to run. The API action will depend on this value. For example: *

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP variables to * be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next * challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access token * and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. If a * user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find the user * name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. *

*

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

* * @return The authentication flow for this call to run. The API action will depend on this value. For example:

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the * next challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access * token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. * If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't * find the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. * @see AuthFlowType */ public final String authFlowAsString() { return authFlow; } /** * For responses, this returns true if the service returned a value for the AuthParameters property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasAuthParameters() { return authParameters != null && !(authParameters instanceof SdkAutoConstructMap); } /** *

* The authentication parameters. These are inputs corresponding to the AuthFlow that you're invoking. * The required values depend on the value of AuthFlow: *

*
    *
  • *

    * For USER_SRP_AUTH: USERNAME (required), SRP_A (required), * SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY * . *

    *
  • *
  • *

    * For USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (required), * SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY * . *

    *
  • *
  • *

    * For REFRESH_TOKEN_AUTH/REFRESH_TOKEN: REFRESH_TOKEN (required), * SECRET_HASH (required if the app client is configured with a client secret), DEVICE_KEY * . *

    *
  • *
  • *

    * For CUSTOM_AUTH: USERNAME (required), SECRET_HASH (if app client is * configured with client secret), DEVICE_KEY. To start the authentication flow with password * verification, include ChallengeName: SRP_A and SRP_A: (The SRP_A Value). *

    *
  • *
*

* For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAuthParameters} method. *

* * @return The authentication parameters. These are inputs corresponding to the AuthFlow that you're * invoking. The required values depend on the value of AuthFlow:

*
    *
  • *

    * For USER_SRP_AUTH: USERNAME (required), SRP_A (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For REFRESH_TOKEN_AUTH/REFRESH_TOKEN: REFRESH_TOKEN (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For CUSTOM_AUTH: USERNAME (required), SECRET_HASH (if app client * is configured with client secret), DEVICE_KEY. To start the authentication flow with * password verification, include ChallengeName: SRP_A and * SRP_A: (The SRP_A Value). *

    *
  • *
*

* For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool. */ public final Map authParameters() { return authParameters; } /** * For responses, this returns true if the service returned a value for the ClientMetadata property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasClientMetadata() { return clientMetadata != null && !(clientMetadata instanceof SdkAutoConstructMap); } /** *

* A map of custom key-value pairs that you can provide as input for certain custom workflows that this action * triggers. *

*

* You create custom workflows by assigning Lambda functions to user pool triggers. When you use the InitiateAuth * API action, Amazon Cognito invokes the Lambda functions that are specified for various triggers. The * ClientMetadata value is passed as input to the functions for only the following triggers: *

*
    *
  • *

    * Pre signup *

    *
  • *
  • *

    * Pre authentication *

    *
  • *
  • *

    * User migration *

    *
  • *
*

* When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function * receives as input. This payload contains a validationData attribute, which provides the data that * you assigned to the ClientMetadata parameter in your InitiateAuth request. In your function code in Lambda, you * can process the validationData value to enhance your workflow for your specific needs. *

*

* When you use the InitiateAuth API action, Amazon Cognito also invokes the functions for the following triggers, * but it doesn't provide the ClientMetadata value as input: *

*
    *
  • *

    * Post authentication *

    *
  • *
  • *

    * Custom message *

    *
  • *
  • *

    * Pre token generation *

    *
  • *
  • *

    * Create auth challenge *

    *
  • *
  • *

    * Define auth challenge *

    *
  • *
*

* For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide. *

* *

* When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following: *

*
    *
  • *

    * Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool * to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata * parameter serves no purpose. *

    *
  • *
  • *

    * Validate the ClientMetadata value. *

    *
  • *
  • *

    * Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information. *

    *
  • *
*
*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasClientMetadata} method. *

* * @return A map of custom key-value pairs that you can provide as input for certain custom workflows that this * action triggers.

*

* You create custom workflows by assigning Lambda functions to user pool triggers. When you use the * InitiateAuth API action, Amazon Cognito invokes the Lambda functions that are specified for various * triggers. The ClientMetadata value is passed as input to the functions for only the following triggers: *

*
    *
  • *

    * Pre signup *

    *
  • *
  • *

    * Pre authentication *

    *
  • *
  • *

    * User migration *

    *
  • *
*

* When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the * function receives as input. This payload contains a validationData attribute, which provides * the data that you assigned to the ClientMetadata parameter in your InitiateAuth request. In your function * code in Lambda, you can process the validationData value to enhance your workflow for your * specific needs. *

*

* When you use the InitiateAuth API action, Amazon Cognito also invokes the functions for the following * triggers, but it doesn't provide the ClientMetadata value as input: *

*
    *
  • *

    * Post authentication *

    *
  • *
  • *

    * Custom message *

    *
  • *
  • *

    * Pre token generation *

    *
  • *
  • *

    * Create auth challenge *

    *
  • *
  • *

    * Define auth challenge *

    *
  • *
*

* For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide. *

* *

* When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following: *

*
    *
  • *

    * Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a * user pool to support custom workflows. If your user pool configuration doesn't include triggers, the * ClientMetadata parameter serves no purpose. *

    *
  • *
  • *

    * Validate the ClientMetadata value. *

    *
  • *
  • *

    * Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information. *

    *
  • *
*/ public final Map clientMetadata() { return clientMetadata; } /** *

* The app client ID. *

* * @return The app client ID. */ public final String clientId() { return clientId; } /** *

* The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls. *

* * @return The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth * calls. */ public final AnalyticsMetadataType analyticsMetadata() { return analyticsMetadata; } /** *

* Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon Cognito * advanced security evaluates the risk of an authentication event based on the context that your app generates and * passes to Amazon Cognito when it makes API requests. *

* * @return Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon * Cognito advanced security evaluates the risk of an authentication event based on the context that your * app generates and passes to Amazon Cognito when it makes API requests. */ public final UserContextDataType userContextData() { return userContextData; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(authFlowAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasAuthParameters() ? authParameters() : null); hashCode = 31 * hashCode + Objects.hashCode(hasClientMetadata() ? clientMetadata() : null); hashCode = 31 * hashCode + Objects.hashCode(clientId()); hashCode = 31 * hashCode + Objects.hashCode(analyticsMetadata()); hashCode = 31 * hashCode + Objects.hashCode(userContextData()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof InitiateAuthRequest)) { return false; } InitiateAuthRequest other = (InitiateAuthRequest) obj; return Objects.equals(authFlowAsString(), other.authFlowAsString()) && hasAuthParameters() == other.hasAuthParameters() && Objects.equals(authParameters(), other.authParameters()) && hasClientMetadata() == other.hasClientMetadata() && Objects.equals(clientMetadata(), other.clientMetadata()) && Objects.equals(clientId(), other.clientId()) && Objects.equals(analyticsMetadata(), other.analyticsMetadata()) && Objects.equals(userContextData(), other.userContextData()); } /** * 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 final String toString() { return ToString.builder("InitiateAuthRequest").add("AuthFlow", authFlowAsString()) .add("AuthParameters", authParameters() == null ? null : "*** Sensitive Data Redacted ***") .add("ClientMetadata", hasClientMetadata() ? clientMetadata() : null) .add("ClientId", clientId() == null ? null : "*** Sensitive Data Redacted ***") .add("AnalyticsMetadata", analyticsMetadata()) .add("UserContextData", userContextData() == null ? null : "*** Sensitive Data Redacted ***").build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AuthFlow": return Optional.ofNullable(clazz.cast(authFlowAsString())); case "AuthParameters": return Optional.ofNullable(clazz.cast(authParameters())); case "ClientMetadata": return Optional.ofNullable(clazz.cast(clientMetadata())); case "ClientId": return Optional.ofNullable(clazz.cast(clientId())); case "AnalyticsMetadata": return Optional.ofNullable(clazz.cast(analyticsMetadata())); case "UserContextData": return Optional.ofNullable(clazz.cast(userContextData())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((InitiateAuthRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CognitoIdentityProviderRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The authentication flow for this call to run. The API action will depend on this value. For example: *

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next * challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access * token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. If * a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find * the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. *

* * @param authFlow * The authentication flow for this call to run. The API action will depend on this value. For * example:

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns * the next challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the * access token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed * directly. If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda * if it doesn't find the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. * @see AuthFlowType * @return Returns a reference to this object so that method calls can be chained together. * @see AuthFlowType */ Builder authFlow(String authFlow); /** *

* The authentication flow for this call to run. The API action will depend on this value. For example: *

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns the next * challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the access * token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed directly. If * a user migration Lambda trigger is set, this flow will invoke the user migration Lambda if it doesn't find * the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. *

* * @param authFlow * The authentication flow for this call to run. The API action will depend on this value. For * example:

*
    *
  • *

    * REFRESH_TOKEN_AUTH takes in a valid refresh token and returns new tokens. *

    *
  • *
  • *

    * USER_SRP_AUTH takes in USERNAME and SRP_A and returns the SRP * variables to be used for next challenge execution. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH takes in USERNAME and PASSWORD and returns * the next challenge or tokens. *

    *
  • *
*

* Valid values include: *

*
    *
  • *

    * USER_SRP_AUTH: Authentication flow for the Secure Remote Password (SRP) protocol. *

    *
  • *
  • *

    * REFRESH_TOKEN_AUTH/REFRESH_TOKEN: Authentication flow for refreshing the * access token and ID token by supplying a valid refresh token. *

    *
  • *
  • *

    * CUSTOM_AUTH: Custom authentication flow. *

    *
  • *
  • *

    * USER_PASSWORD_AUTH: Non-SRP authentication flow; user name and password are passed * directly. If a user migration Lambda trigger is set, this flow will invoke the user migration Lambda * if it doesn't find the user name in the user pool. *

    *
  • *
*

* ADMIN_NO_SRP_AUTH isn't a valid value. * @see AuthFlowType * @return Returns a reference to this object so that method calls can be chained together. * @see AuthFlowType */ Builder authFlow(AuthFlowType authFlow); /** *

* The authentication parameters. These are inputs corresponding to the AuthFlow that you're * invoking. The required values depend on the value of AuthFlow: *

*
    *
  • *

    * For USER_SRP_AUTH: USERNAME (required), SRP_A (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For USER_PASSWORD_AUTH: USERNAME (required), PASSWORD (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For REFRESH_TOKEN_AUTH/REFRESH_TOKEN: REFRESH_TOKEN (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For CUSTOM_AUTH: USERNAME (required), SECRET_HASH (if app client is * configured with client secret), DEVICE_KEY. To start the authentication flow with password * verification, include ChallengeName: SRP_A and SRP_A: (The SRP_A Value). *

    *
  • *
*

* For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool. *

* * @param authParameters * The authentication parameters. These are inputs corresponding to the AuthFlow that you're * invoking. The required values depend on the value of AuthFlow:

*
    *
  • *

    * For USER_SRP_AUTH: USERNAME (required), SRP_A (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For USER_PASSWORD_AUTH: USERNAME (required), PASSWORD * (required), SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For REFRESH_TOKEN_AUTH/REFRESH_TOKEN: REFRESH_TOKEN (required), * SECRET_HASH (required if the app client is configured with a client secret), * DEVICE_KEY. *

    *
  • *
  • *

    * For CUSTOM_AUTH: USERNAME (required), SECRET_HASH (if app * client is configured with client secret), DEVICE_KEY. To start the authentication flow * with password verification, include ChallengeName: SRP_A and * SRP_A: (The SRP_A Value). *

    *
  • *
*

* For more information about SECRET_HASH, see Computing secret hash values. For information about DEVICE_KEY, see Working with user devices in your user pool. * @return Returns a reference to this object so that method calls can be chained together. */ Builder authParameters(Map authParameters); /** *

* A map of custom key-value pairs that you can provide as input for certain custom workflows that this action * triggers. *

*

* You create custom workflows by assigning Lambda functions to user pool triggers. When you use the * InitiateAuth API action, Amazon Cognito invokes the Lambda functions that are specified for various triggers. * The ClientMetadata value is passed as input to the functions for only the following triggers: *

*
    *
  • *

    * Pre signup *

    *
  • *
  • *

    * Pre authentication *

    *
  • *
  • *

    * User migration *

    *
  • *
*

* When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function * receives as input. This payload contains a validationData attribute, which provides the data * that you assigned to the ClientMetadata parameter in your InitiateAuth request. In your function code in * Lambda, you can process the validationData value to enhance your workflow for your specific * needs. *

*

* When you use the InitiateAuth API action, Amazon Cognito also invokes the functions for the following * triggers, but it doesn't provide the ClientMetadata value as input: *

*
    *
  • *

    * Post authentication *

    *
  • *
  • *

    * Custom message *

    *
  • *
  • *

    * Pre token generation *

    *
  • *
  • *

    * Create auth challenge *

    *
  • *
  • *

    * Define auth challenge *

    *
  • *
*

* For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer Guide. *

* *

* When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following: *

*
    *
  • *

    * Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user * pool to support custom workflows. If your user pool configuration doesn't include triggers, the * ClientMetadata parameter serves no purpose. *

    *
  • *
  • *

    * Validate the ClientMetadata value. *

    *
  • *
  • *

    * Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information. *

    *
  • *
*
* * @param clientMetadata * A map of custom key-value pairs that you can provide as input for certain custom workflows that this * action triggers.

*

* You create custom workflows by assigning Lambda functions to user pool triggers. When you use the * InitiateAuth API action, Amazon Cognito invokes the Lambda functions that are specified for various * triggers. The ClientMetadata value is passed as input to the functions for only the following * triggers: *

*
    *
  • *

    * Pre signup *

    *
  • *
  • *

    * Pre authentication *

    *
  • *
  • *

    * User migration *

    *
  • *
*

* When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the * function receives as input. This payload contains a validationData attribute, which * provides the data that you assigned to the ClientMetadata parameter in your InitiateAuth request. In * your function code in Lambda, you can process the validationData value to enhance your * workflow for your specific needs. *

*

* When you use the InitiateAuth API action, Amazon Cognito also invokes the functions for the following * triggers, but it doesn't provide the ClientMetadata value as input: *

*
    *
  • *

    * Post authentication *

    *
  • *
  • *

    * Custom message *

    *
  • *
  • *

    * Pre token generation *

    *
  • *
  • *

    * Create auth challenge *

    *
  • *
  • *

    * Define auth challenge *

    *
  • *
*

* For more information, see Customizing user pool Workflows with Lambda Triggers in the Amazon Cognito Developer * Guide. *

* *

* When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following: *

*
    *
  • *

    * Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a * user pool to support custom workflows. If your user pool configuration doesn't include triggers, the * ClientMetadata parameter serves no purpose. *

    *
  • *
  • *

    * Validate the ClientMetadata value. *

    *
  • *
  • *

    * Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information. *

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

* The app client ID. *

* * @param clientId * The app client ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientId(String clientId); /** *

* The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls. *

* * @param analyticsMetadata * The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth * calls. * @return Returns a reference to this object so that method calls can be chained together. */ Builder analyticsMetadata(AnalyticsMetadataType analyticsMetadata); /** *

* The Amazon Pinpoint analytics metadata that contributes to your metrics for InitiateAuth calls. *

* This is a convenience method that creates an instance of the {@link AnalyticsMetadataType.Builder} avoiding * the need to create one manually via {@link AnalyticsMetadataType#builder()}. * *

* When the {@link Consumer} completes, {@link AnalyticsMetadataType.Builder#build()} is called immediately and * its result is passed to {@link #analyticsMetadata(AnalyticsMetadataType)}. * * @param analyticsMetadata * a consumer that will call methods on {@link AnalyticsMetadataType.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #analyticsMetadata(AnalyticsMetadataType) */ default Builder analyticsMetadata(Consumer analyticsMetadata) { return analyticsMetadata(AnalyticsMetadataType.builder().applyMutation(analyticsMetadata).build()); } /** *

* Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon * Cognito advanced security evaluates the risk of an authentication event based on the context that your app * generates and passes to Amazon Cognito when it makes API requests. *

* * @param userContextData * Contextual data about your user session, such as the device fingerprint, IP address, or location. * Amazon Cognito advanced security evaluates the risk of an authentication event based on the context * that your app generates and passes to Amazon Cognito when it makes API requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userContextData(UserContextDataType userContextData); /** *

* Contextual data about your user session, such as the device fingerprint, IP address, or location. Amazon * Cognito advanced security evaluates the risk of an authentication event based on the context that your app * generates and passes to Amazon Cognito when it makes API requests. *

* This is a convenience method that creates an instance of the {@link UserContextDataType.Builder} avoiding the * need to create one manually via {@link UserContextDataType#builder()}. * *

* When the {@link Consumer} completes, {@link UserContextDataType.Builder#build()} is called immediately and * its result is passed to {@link #userContextData(UserContextDataType)}. * * @param userContextData * a consumer that will call methods on {@link UserContextDataType.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #userContextData(UserContextDataType) */ default Builder userContextData(Consumer userContextData) { return userContextData(UserContextDataType.builder().applyMutation(userContextData).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CognitoIdentityProviderRequest.BuilderImpl implements Builder { private String authFlow; private Map authParameters = DefaultSdkAutoConstructMap.getInstance(); private Map clientMetadata = DefaultSdkAutoConstructMap.getInstance(); private String clientId; private AnalyticsMetadataType analyticsMetadata; private UserContextDataType userContextData; private BuilderImpl() { } private BuilderImpl(InitiateAuthRequest model) { super(model); authFlow(model.authFlow); authParameters(model.authParameters); clientMetadata(model.clientMetadata); clientId(model.clientId); analyticsMetadata(model.analyticsMetadata); userContextData(model.userContextData); } public final String getAuthFlow() { return authFlow; } public final void setAuthFlow(String authFlow) { this.authFlow = authFlow; } @Override public final Builder authFlow(String authFlow) { this.authFlow = authFlow; return this; } @Override public final Builder authFlow(AuthFlowType authFlow) { this.authFlow(authFlow == null ? null : authFlow.toString()); return this; } public final Map getAuthParameters() { if (authParameters instanceof SdkAutoConstructMap) { return null; } return authParameters; } public final void setAuthParameters(Map authParameters) { this.authParameters = AuthParametersTypeCopier.copy(authParameters); } @Override public final Builder authParameters(Map authParameters) { this.authParameters = AuthParametersTypeCopier.copy(authParameters); return this; } public final Map getClientMetadata() { if (clientMetadata instanceof SdkAutoConstructMap) { return null; } return clientMetadata; } public final void setClientMetadata(Map clientMetadata) { this.clientMetadata = ClientMetadataTypeCopier.copy(clientMetadata); } @Override public final Builder clientMetadata(Map clientMetadata) { this.clientMetadata = ClientMetadataTypeCopier.copy(clientMetadata); return this; } public final String getClientId() { return clientId; } public final void setClientId(String clientId) { this.clientId = clientId; } @Override public final Builder clientId(String clientId) { this.clientId = clientId; return this; } public final AnalyticsMetadataType.Builder getAnalyticsMetadata() { return analyticsMetadata != null ? analyticsMetadata.toBuilder() : null; } public final void setAnalyticsMetadata(AnalyticsMetadataType.BuilderImpl analyticsMetadata) { this.analyticsMetadata = analyticsMetadata != null ? analyticsMetadata.build() : null; } @Override public final Builder analyticsMetadata(AnalyticsMetadataType analyticsMetadata) { this.analyticsMetadata = analyticsMetadata; return this; } public final UserContextDataType.Builder getUserContextData() { return userContextData != null ? userContextData.toBuilder() : null; } public final void setUserContextData(UserContextDataType.BuilderImpl userContextData) { this.userContextData = userContextData != null ? userContextData.build() : null; } @Override public final Builder userContextData(UserContextDataType userContextData) { this.userContextData = userContextData; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public InitiateAuthRequest build() { return new InitiateAuthRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy