1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cognitoidentityprovider
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider/types"
9	"github.com/aws/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Allows a user to enter a confirmation code to reset a forgotten password.
14func (c *Client) ConfirmForgotPassword(ctx context.Context, params *ConfirmForgotPasswordInput, optFns ...func(*Options)) (*ConfirmForgotPasswordOutput, error) {
15	if params == nil {
16		params = &ConfirmForgotPasswordInput{}
17	}
18
19	result, metadata, err := c.invokeOperation(ctx, "ConfirmForgotPassword", params, optFns, addOperationConfirmForgotPasswordMiddlewares)
20	if err != nil {
21		return nil, err
22	}
23
24	out := result.(*ConfirmForgotPasswordOutput)
25	out.ResultMetadata = metadata
26	return out, nil
27}
28
29// The request representing the confirmation for a password reset.
30type ConfirmForgotPasswordInput struct {
31
32	// The app client ID of the app associated with the user pool.
33	//
34	// This member is required.
35	ClientId *string
36
37	// The confirmation code sent by a user's request to retrieve a forgotten password.
38	// For more information, see ForgotPassword
39	// (https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html).
40	//
41	// This member is required.
42	ConfirmationCode *string
43
44	// The password sent by a user's request to retrieve a forgotten password.
45	//
46	// This member is required.
47	Password *string
48
49	// The user name of the user for whom you want to enter a code to retrieve a
50	// forgotten password.
51	//
52	// This member is required.
53	Username *string
54
55	// The Amazon Pinpoint analytics metadata for collecting metrics for
56	// ConfirmForgotPassword calls.
57	AnalyticsMetadata *types.AnalyticsMetadataType
58
59	// A map of custom key-value pairs that you can provide as input for any custom
60	// workflows that this action triggers. You create custom workflows by assigning
61	// AWS Lambda functions to user pool triggers. When you use the
62	// ConfirmForgotPassword API action, Amazon Cognito invokes the function that is
63	// assigned to the post confirmation trigger. When Amazon Cognito invokes this
64	// function, it passes a JSON payload, which the function receives as input. This
65	// payload contains a clientMetadata attribute, which provides the data that you
66	// assigned to the ClientMetadata parameter in your ConfirmForgotPassword request.
67	// In your function code in AWS Lambda, you can process the clientMetadata value to
68	// enhance your workflow for your specific needs. For more information, see
69	// Customizing User Pool Workflows with Lambda Triggers
70	// (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html)
71	// in the Amazon Cognito Developer Guide. Take the following limitations into
72	// consideration when you use the ClientMetadata parameter:
73	//
74	// * Amazon Cognito does
75	// not store the ClientMetadata value. This data is available only to AWS Lambda
76	// triggers that are assigned to a user pool to support custom workflows. If your
77	// user pool configuration does not include triggers, the ClientMetadata parameter
78	// serves no purpose.
79	//
80	// * Amazon Cognito does not validate the ClientMetadata
81	// value.
82	//
83	// * Amazon Cognito does not encrypt the the ClientMetadata value, so don't
84	// use it to provide sensitive information.
85	ClientMetadata map[string]string
86
87	// A keyed-hash message authentication code (HMAC) calculated using the secret key
88	// of a user pool client and username plus the client ID in the message.
89	SecretHash *string
90
91	// Contextual data such as the user's device fingerprint, IP address, or location
92	// used for evaluating the risk of an unexpected event by Amazon Cognito advanced
93	// security.
94	UserContextData *types.UserContextDataType
95}
96
97// The response from the server that results from a user's request to retrieve a
98// forgotten password.
99type ConfirmForgotPasswordOutput struct {
100	// Metadata pertaining to the operation's result.
101	ResultMetadata middleware.Metadata
102}
103
104func addOperationConfirmForgotPasswordMiddlewares(stack *middleware.Stack, options Options) (err error) {
105	err = stack.Serialize.Add(&awsAwsjson11_serializeOpConfirmForgotPassword{}, middleware.After)
106	if err != nil {
107		return err
108	}
109	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpConfirmForgotPassword{}, middleware.After)
110	if err != nil {
111		return err
112	}
113	if err = addSetLoggerMiddleware(stack, options); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addResolveEndpointMiddleware(stack, options); err != nil {
123		return err
124	}
125	if err = addRetryMiddlewares(stack, options); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
129		return err
130	}
131	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
132		return err
133	}
134	if err = addClientUserAgent(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
138		return err
139	}
140	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addOpConfirmForgotPasswordValidationMiddleware(stack); err != nil {
144		return err
145	}
146	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opConfirmForgotPassword(options.Region), middleware.Before); err != nil {
147		return err
148	}
149	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
150		return err
151	}
152	if err = addResponseErrorMiddleware(stack); err != nil {
153		return err
154	}
155	if err = addRequestResponseLogging(stack, options); err != nil {
156		return err
157	}
158	return nil
159}
160
161func newServiceMetadataMiddleware_opConfirmForgotPassword(region string) *awsmiddleware.RegisterServiceMetadata {
162	return &awsmiddleware.RegisterServiceMetadata{
163		Region:        region,
164		ServiceID:     ServiceID,
165		OperationName: "ConfirmForgotPassword",
166	}
167}
168