1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Initiates the authentication request.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct InitiateAuthInput {
/// <p>The authentication flow for this call to run. The API action will depend on this value. For example:</p>
/// <ul>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code> takes in a valid refresh token and returns new tokens.</p> </li>
/// <li> <p> <code>USER_SRP_AUTH</code> takes in <code>USERNAME</code> and <code>SRP_A</code> and returns the SRP variables to be used for next challenge execution.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code> takes in <code>USERNAME</code> and <code>PASSWORD</code> and returns the next challenge or tokens.</p> </li>
/// </ul>
/// <p>Valid values include:</p>
/// <ul>
/// <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li>
/// <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code>: 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. </p> </li>
/// </ul>
/// <p> <code>ADMIN_NO_SRP_AUTH</code> isn't a valid value.</p>
#[doc(hidden)]
pub auth_flow: std::option::Option<crate::types::AuthFlowType>,
/// <p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you're invoking. The required values depend on the value of <code>AuthFlow</code>:</p>
/// <ul>
/// <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRP_A</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>REFRESH_TOKEN</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code>. To start the authentication flow with password verification, include <code>ChallengeName: SRP_A</code> and <code>SRP_A: (The SRP_A Value)</code>.</p> </li>
/// </ul>
#[doc(hidden)]
pub auth_parameters:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
/// <p>A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Pre signup</p> </li>
/// <li> <p>Pre authentication</p> </li>
/// <li> <p>User migration</p> </li>
/// </ul>
/// <p>When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a <code>validationData</code> 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 <code>validationData</code> value to enhance your workflow for your specific needs.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Post authentication</p> </li>
/// <li> <p>Custom message</p> </li>
/// <li> <p>Pre token generation</p> </li>
/// <li> <p>Create auth challenge</p> </li>
/// <li> <p>Define auth challenge</p> </li>
/// <li> <p>Verify auth challenge</p> </li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Customizing user pool Workflows with Lambda Triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p> <note>
/// <p>When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:</p>
/// <ul>
/// <li> <p>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.</p> </li>
/// <li> <p>Validate the ClientMetadata value.</p> </li>
/// <li> <p>Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.</p> </li>
/// </ul>
/// </note>
#[doc(hidden)]
pub client_metadata:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
/// <p>The app client ID.</p>
#[doc(hidden)]
pub client_id: std::option::Option<std::string::String>,
/// <p>The Amazon Pinpoint analytics metadata that contributes to your metrics for <code>InitiateAuth</code> calls.</p>
#[doc(hidden)]
pub analytics_metadata: std::option::Option<crate::types::AnalyticsMetadataType>,
/// <p>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.</p>
#[doc(hidden)]
pub user_context_data: std::option::Option<crate::types::UserContextDataType>,
}
impl InitiateAuthInput {
/// <p>The authentication flow for this call to run. The API action will depend on this value. For example:</p>
/// <ul>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code> takes in a valid refresh token and returns new tokens.</p> </li>
/// <li> <p> <code>USER_SRP_AUTH</code> takes in <code>USERNAME</code> and <code>SRP_A</code> and returns the SRP variables to be used for next challenge execution.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code> takes in <code>USERNAME</code> and <code>PASSWORD</code> and returns the next challenge or tokens.</p> </li>
/// </ul>
/// <p>Valid values include:</p>
/// <ul>
/// <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li>
/// <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code>: 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. </p> </li>
/// </ul>
/// <p> <code>ADMIN_NO_SRP_AUTH</code> isn't a valid value.</p>
pub fn auth_flow(&self) -> std::option::Option<&crate::types::AuthFlowType> {
self.auth_flow.as_ref()
}
/// <p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you're invoking. The required values depend on the value of <code>AuthFlow</code>:</p>
/// <ul>
/// <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRP_A</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>REFRESH_TOKEN</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code>. To start the authentication flow with password verification, include <code>ChallengeName: SRP_A</code> and <code>SRP_A: (The SRP_A Value)</code>.</p> </li>
/// </ul>
pub fn auth_parameters(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.auth_parameters.as_ref()
}
/// <p>A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Pre signup</p> </li>
/// <li> <p>Pre authentication</p> </li>
/// <li> <p>User migration</p> </li>
/// </ul>
/// <p>When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a <code>validationData</code> 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 <code>validationData</code> value to enhance your workflow for your specific needs.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Post authentication</p> </li>
/// <li> <p>Custom message</p> </li>
/// <li> <p>Pre token generation</p> </li>
/// <li> <p>Create auth challenge</p> </li>
/// <li> <p>Define auth challenge</p> </li>
/// <li> <p>Verify auth challenge</p> </li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Customizing user pool Workflows with Lambda Triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p> <note>
/// <p>When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:</p>
/// <ul>
/// <li> <p>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.</p> </li>
/// <li> <p>Validate the ClientMetadata value.</p> </li>
/// <li> <p>Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.</p> </li>
/// </ul>
/// </note>
pub fn client_metadata(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.client_metadata.as_ref()
}
/// <p>The app client ID.</p>
pub fn client_id(&self) -> std::option::Option<&str> {
self.client_id.as_deref()
}
/// <p>The Amazon Pinpoint analytics metadata that contributes to your metrics for <code>InitiateAuth</code> calls.</p>
pub fn analytics_metadata(&self) -> std::option::Option<&crate::types::AnalyticsMetadataType> {
self.analytics_metadata.as_ref()
}
/// <p>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.</p>
pub fn user_context_data(&self) -> std::option::Option<&crate::types::UserContextDataType> {
self.user_context_data.as_ref()
}
}
impl std::fmt::Debug for InitiateAuthInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("InitiateAuthInput");
formatter.field("auth_flow", &self.auth_flow);
formatter.field("auth_parameters", &"*** Sensitive Data Redacted ***");
formatter.field("client_metadata", &self.client_metadata);
formatter.field("client_id", &"*** Sensitive Data Redacted ***");
formatter.field("analytics_metadata", &self.analytics_metadata);
formatter.field("user_context_data", &self.user_context_data);
formatter.finish()
}
}
impl InitiateAuthInput {
/// Creates a new builder-style object to manufacture [`InitiateAuthInput`](crate::operation::initiate_auth::InitiateAuthInput).
pub fn builder() -> crate::operation::initiate_auth::builders::InitiateAuthInputBuilder {
crate::operation::initiate_auth::builders::InitiateAuthInputBuilder::default()
}
}
/// A builder for [`InitiateAuthInput`](crate::operation::initiate_auth::InitiateAuthInput).
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default)]
pub struct InitiateAuthInputBuilder {
pub(crate) auth_flow: std::option::Option<crate::types::AuthFlowType>,
pub(crate) auth_parameters:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
pub(crate) client_metadata:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
pub(crate) client_id: std::option::Option<std::string::String>,
pub(crate) analytics_metadata: std::option::Option<crate::types::AnalyticsMetadataType>,
pub(crate) user_context_data: std::option::Option<crate::types::UserContextDataType>,
}
impl InitiateAuthInputBuilder {
/// <p>The authentication flow for this call to run. The API action will depend on this value. For example:</p>
/// <ul>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code> takes in a valid refresh token and returns new tokens.</p> </li>
/// <li> <p> <code>USER_SRP_AUTH</code> takes in <code>USERNAME</code> and <code>SRP_A</code> and returns the SRP variables to be used for next challenge execution.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code> takes in <code>USERNAME</code> and <code>PASSWORD</code> and returns the next challenge or tokens.</p> </li>
/// </ul>
/// <p>Valid values include:</p>
/// <ul>
/// <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li>
/// <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code>: 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. </p> </li>
/// </ul>
/// <p> <code>ADMIN_NO_SRP_AUTH</code> isn't a valid value.</p>
pub fn auth_flow(mut self, input: crate::types::AuthFlowType) -> Self {
self.auth_flow = Some(input);
self
}
/// <p>The authentication flow for this call to run. The API action will depend on this value. For example:</p>
/// <ul>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code> takes in a valid refresh token and returns new tokens.</p> </li>
/// <li> <p> <code>USER_SRP_AUTH</code> takes in <code>USERNAME</code> and <code>SRP_A</code> and returns the SRP variables to be used for next challenge execution.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code> takes in <code>USERNAME</code> and <code>PASSWORD</code> and returns the next challenge or tokens.</p> </li>
/// </ul>
/// <p>Valid values include:</p>
/// <ul>
/// <li> <p> <code>USER_SRP_AUTH</code>: Authentication flow for the Secure Remote Password (SRP) protocol.</p> </li>
/// <li> <p> <code>REFRESH_TOKEN_AUTH</code>/<code>REFRESH_TOKEN</code>: Authentication flow for refreshing the access token and ID token by supplying a valid refresh token.</p> </li>
/// <li> <p> <code>CUSTOM_AUTH</code>: Custom authentication flow.</p> </li>
/// <li> <p> <code>USER_PASSWORD_AUTH</code>: 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. </p> </li>
/// </ul>
/// <p> <code>ADMIN_NO_SRP_AUTH</code> isn't a valid value.</p>
pub fn set_auth_flow(mut self, input: std::option::Option<crate::types::AuthFlowType>) -> Self {
self.auth_flow = input;
self
}
/// Adds a key-value pair to `auth_parameters`.
///
/// To override the contents of this collection use [`set_auth_parameters`](Self::set_auth_parameters).
///
/// <p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you're invoking. The required values depend on the value of <code>AuthFlow</code>:</p>
/// <ul>
/// <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRP_A</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>REFRESH_TOKEN</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code>. To start the authentication flow with password verification, include <code>ChallengeName: SRP_A</code> and <code>SRP_A: (The SRP_A Value)</code>.</p> </li>
/// </ul>
pub fn auth_parameters(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.auth_parameters.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.auth_parameters = Some(hash_map);
self
}
/// <p>The authentication parameters. These are inputs corresponding to the <code>AuthFlow</code> that you're invoking. The required values depend on the value of <code>AuthFlow</code>:</p>
/// <ul>
/// <li> <p>For <code>USER_SRP_AUTH</code>: <code>USERNAME</code> (required), <code>SRP_A</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>REFRESH_TOKEN_AUTH/REFRESH_TOKEN</code>: <code>REFRESH_TOKEN</code> (required), <code>SECRET_HASH</code> (required if the app client is configured with a client secret), <code>DEVICE_KEY</code>.</p> </li>
/// <li> <p>For <code>CUSTOM_AUTH</code>: <code>USERNAME</code> (required), <code>SECRET_HASH</code> (if app client is configured with client secret), <code>DEVICE_KEY</code>. To start the authentication flow with password verification, include <code>ChallengeName: SRP_A</code> and <code>SRP_A: (The SRP_A Value)</code>.</p> </li>
/// </ul>
pub fn set_auth_parameters(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.auth_parameters = input;
self
}
/// Adds a key-value pair to `client_metadata`.
///
/// To override the contents of this collection use [`set_client_metadata`](Self::set_client_metadata).
///
/// <p>A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Pre signup</p> </li>
/// <li> <p>Pre authentication</p> </li>
/// <li> <p>User migration</p> </li>
/// </ul>
/// <p>When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a <code>validationData</code> 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 <code>validationData</code> value to enhance your workflow for your specific needs.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Post authentication</p> </li>
/// <li> <p>Custom message</p> </li>
/// <li> <p>Pre token generation</p> </li>
/// <li> <p>Create auth challenge</p> </li>
/// <li> <p>Define auth challenge</p> </li>
/// <li> <p>Verify auth challenge</p> </li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Customizing user pool Workflows with Lambda Triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p> <note>
/// <p>When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:</p>
/// <ul>
/// <li> <p>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.</p> </li>
/// <li> <p>Validate the ClientMetadata value.</p> </li>
/// <li> <p>Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.</p> </li>
/// </ul>
/// </note>
pub fn client_metadata(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.client_metadata.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.client_metadata = Some(hash_map);
self
}
/// <p>A map of custom key-value pairs that you can provide as input for certain custom workflows that this action triggers.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Pre signup</p> </li>
/// <li> <p>Pre authentication</p> </li>
/// <li> <p>User migration</p> </li>
/// </ul>
/// <p>When Amazon Cognito invokes the functions for these triggers, it passes a JSON payload, which the function receives as input. This payload contains a <code>validationData</code> 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 <code>validationData</code> value to enhance your workflow for your specific needs.</p>
/// <p>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:</p>
/// <ul>
/// <li> <p>Post authentication</p> </li>
/// <li> <p>Custom message</p> </li>
/// <li> <p>Pre token generation</p> </li>
/// <li> <p>Create auth challenge</p> </li>
/// <li> <p>Define auth challenge</p> </li>
/// <li> <p>Verify auth challenge</p> </li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Customizing user pool Workflows with Lambda Triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p> <note>
/// <p>When you use the ClientMetadata parameter, remember that Amazon Cognito won't do the following:</p>
/// <ul>
/// <li> <p>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.</p> </li>
/// <li> <p>Validate the ClientMetadata value.</p> </li>
/// <li> <p>Encrypt the ClientMetadata value. Don't use Amazon Cognito to provide sensitive information.</p> </li>
/// </ul>
/// </note>
pub fn set_client_metadata(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.client_metadata = input;
self
}
/// <p>The app client ID.</p>
pub fn client_id(mut self, input: impl Into<std::string::String>) -> Self {
self.client_id = Some(input.into());
self
}
/// <p>The app client ID.</p>
pub fn set_client_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_id = input;
self
}
/// <p>The Amazon Pinpoint analytics metadata that contributes to your metrics for <code>InitiateAuth</code> calls.</p>
pub fn analytics_metadata(mut self, input: crate::types::AnalyticsMetadataType) -> Self {
self.analytics_metadata = Some(input);
self
}
/// <p>The Amazon Pinpoint analytics metadata that contributes to your metrics for <code>InitiateAuth</code> calls.</p>
pub fn set_analytics_metadata(
mut self,
input: std::option::Option<crate::types::AnalyticsMetadataType>,
) -> Self {
self.analytics_metadata = input;
self
}
/// <p>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.</p>
pub fn user_context_data(mut self, input: crate::types::UserContextDataType) -> Self {
self.user_context_data = Some(input);
self
}
/// <p>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.</p>
pub fn set_user_context_data(
mut self,
input: std::option::Option<crate::types::UserContextDataType>,
) -> Self {
self.user_context_data = input;
self
}
/// Consumes the builder and constructs a [`InitiateAuthInput`](crate::operation::initiate_auth::InitiateAuthInput).
pub fn build(
self,
) -> Result<
crate::operation::initiate_auth::InitiateAuthInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::operation::initiate_auth::InitiateAuthInput {
auth_flow: self.auth_flow,
auth_parameters: self.auth_parameters,
client_metadata: self.client_metadata,
client_id: self.client_id,
analytics_metadata: self.analytics_metadata,
user_context_data: self.user_context_data,
})
}
}
impl std::fmt::Debug for InitiateAuthInputBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("InitiateAuthInputBuilder");
formatter.field("auth_flow", &self.auth_flow);
formatter.field("auth_parameters", &"*** Sensitive Data Redacted ***");
formatter.field("client_metadata", &self.client_metadata);
formatter.field("client_id", &"*** Sensitive Data Redacted ***");
formatter.field("analytics_metadata", &self.analytics_metadata);
formatter.field("user_context_data", &self.user_context_data);
formatter.finish()
}
}