forked from aws-amplify/aws-sdk-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAWSCognitoIdentityUser.h
244 lines (180 loc) · 7.74 KB
/
AWSCognitoIdentityUser.h
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
//
// Copyright 2014-2016 Amazon.com,
// Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Amazon Software License (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/asl/
//
// or in the "license" file accompanying this file. This file is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, express or implied. See the License
// for the specific language governing permissions and
// limitations under the License.
//
#import <Foundation/Foundation.h>
#import "AWSCognitoIdentityProviderService.h"
/**
The status of the user.
<ul>
<li>AWSCognitoIdentityUserStatusUnknown - The user status is unknown.</li>
<li>AWSCognitoIdentityUserStatusConfirmed - The user was auto confirmed.</li>
<li>AWSCognitoIdentityUserStatusUnconfirmed - The user was not confirmed.</li>
</ul>
*/
typedef NS_ENUM(NSInteger, AWSCognitoIdentityUserStatus) {
AWSCognitoIdentityUserStatusUnknown = 0,
AWSCognitoIdentityUserStatusConfirmed = -1000,
AWSCognitoIdentityUserStatusUnconfirmed = -2000,
};
@class AWSCognitoIdentityUserPool;
@class AWSCognitoIdentityUserSession;
@class AWSCognitoIdentityUserSessionToken;
@class AWSCognitoIdentityUserSettings;
@class AWSCognitoIdentityUserMFAOption;
@class AWSCognitoIdentityUserConfirmSignUpResponse;
@class AWSCognitoIdentityUserGetDetailsResponse;
@class AWSCognitoIdentityUserResendConfirmationCodeResponse;
@class AWSCognitoIdentityUserForgotPasswordResponse;
@class AWSCognitoIdentityUserConfirmForgotPasswordResponse;
@class AWSCognitoIdentityUserChangePasswordResponse;
@class AWSCognitoIdentityUserAttributeType;
@class AWSCognitoIdentityUserUpdateAttributesResponse;
@class AWSCognitoIdentityUserDeleteAttributesResponse;
@class AWSCognitoIdentityUserVerifyAttributeResponse;
@class AWSCognitoIdentityUserGetAttributeVerificationCodeResponse;
@class AWSCognitoIdentityUserSetUserSettingsResponse;
NS_ASSUME_NONNULL_BEGIN
@interface AWSCognitoIdentityUser : NSObject
/**
The username of this user
*/
@property (nonatomic, readonly, nullable) NSString *username;
/**
If this user is a result of a signup, this has the confirmation status
*/
@property (nonatomic, readonly) AWSCognitoIdentityUserStatus confirmedStatus;
/**
Confirm a users' sign up with the confirmation code
*/
- (AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *)confirmSignUp:(NSString *)confirmationCode;
/**
Resend the confirmation code sent during sign up
*/
- (AWSTask<AWSCognitoIdentityUserResendConfirmationCodeResponse *> *)resendConfirmationCode;
/**
Get a session with default scopes
*/
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession;
/**
Get a session with custom scopes. For future use, not supported by service yet.
*/
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(nullable NSSet<NSString *> *)scopes;
/**
Get a session with the following username and password
*/
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData
scopes:(nullable NSSet<NSString *> *)scopes;
/**
Get details about this user, including user attributes
*/
- (AWSTask<AWSCognitoIdentityUserGetDetailsResponse *> *)getDetails;
/**
Send a code to this user to initiate the forgot password flow
*/
- (AWSTask<AWSCognitoIdentityUserForgotPasswordResponse *> *)forgotPassword;
/**
Conclude the forgot password flow by providing the forgot password code and new password.
*/
- (AWSTask<AWSCognitoIdentityUserConfirmForgotPasswordResponse *> *)confirmForgotPassword:(NSString *)confirmationCode
password:(NSString *)password;
/**
Change this user's password
*/
- (AWSTask<AWSCognitoIdentityUserChangePasswordResponse *> *)changePassword:(NSString *)currentPassword
proposedPassword:(NSString *)proposedPassword;
/**
Update this user's attributes
*/
- (AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> *)updateAttributes:(NSArray<AWSCognitoIdentityUserAttributeType *> *)attributes;
/**
Delete the attributes specified by attributeNames
*/
- (AWSTask<AWSCognitoIdentityUserDeleteAttributesResponse *> *)deleteAttributes:(NSArray<NSString *> *)attributeNames;
/**
Verify a user attribute upon receiving the verification code.
*/
- (AWSTask<AWSCognitoIdentityUserVerifyAttributeResponse *> *)verifyAttribute:(NSString *)attributeName
code:(NSString *)code;
/**
Request a verification code to verify an attribute.
*/
- (AWSTask<AWSCognitoIdentityUserGetAttributeVerificationCodeResponse *> *)getAttributeVerificationCode:(NSString *)attributeName;
/**
Set the user settings for this user such as MFA
*/
- (AWSTask<AWSCognitoIdentityUserSetUserSettingsResponse *> *)setUserSettings:(AWSCognitoIdentityUserSettings *)settings;
/**
Delete this user
*/
- (AWSTask *)deleteUser;
/**
Remove all sessions from the keychain for this user
*/
- (void)signOut;
@end
/**
A User session. Encapsulates all tokens (id, access and refresh tokens) for a user.
*/
@interface AWSCognitoIdentityUserSession : NSObject
@property (nonatomic, readonly) AWSCognitoIdentityUserSessionToken * _Nullable idToken;
@property (nonatomic, readonly) AWSCognitoIdentityUserSessionToken * _Nullable accessToken;
@property (nonatomic, readonly) AWSCognitoIdentityUserSessionToken * _Nullable refreshToken;
@property (nonatomic, readonly) NSDate * _Nullable expirationTime;
@end
/**
A JWT session token.
*/
@interface AWSCognitoIdentityUserSessionToken : NSObject
@property (nonatomic, readonly) NSString * tokenString;
@end
/**
User settings. Currently only mfa options.
*/
@interface AWSCognitoIdentityUserSettings : NSObject
@property (nonatomic, copy) NSArray<AWSCognitoIdentityUserMFAOption *>* _Nullable mfaOptions;
@end
@interface AWSCognitoIdentityUserMFAOption : NSObject
@property (nonatomic, strong) NSString * attributeName;
@property (nonatomic, assign) AWSCognitoIdentityProviderDeliveryMediumType deliveryMedium;
@end
@interface AWSCognitoIdentityUserAttributeType : AWSCognitoIdentityProviderAttributeType
@end
#pragma Response wrappers
@interface AWSCognitoIdentityUserConfirmSignUpResponse : AWSCognitoIdentityProviderConfirmSignUpResponse
@end
@interface AWSCognitoIdentityUserResendConfirmationCodeResponse :AWSCognitoIdentityProviderResendConfirmationCodeResponse
@end
@interface AWSCognitoIdentityUserGetDetailsResponse : AWSCognitoIdentityProviderGetUserResponse
@end
@interface AWSCognitoIdentityUserForgotPasswordResponse : AWSCognitoIdentityProviderForgotPasswordResponse
@end
@interface AWSCognitoIdentityUserConfirmForgotPasswordResponse : AWSCognitoIdentityProviderConfirmForgotPasswordResponse
@end
@interface AWSCognitoIdentityUserChangePasswordResponse : AWSCognitoIdentityProviderChangePasswordResponse
@end
@interface AWSCognitoIdentityUserUpdateAttributesResponse : AWSCognitoIdentityProviderUpdateUserAttributesResponse
@end
@interface AWSCognitoIdentityUserDeleteAttributesResponse : AWSCognitoIdentityProviderDeleteUserAttributesResponse
@end
@interface AWSCognitoIdentityUserVerifyAttributeResponse : AWSCognitoIdentityProviderVerifyUserAttributeResponse
@end
@interface AWSCognitoIdentityUserGetAttributeVerificationCodeResponse : AWSCognitoIdentityProviderGetUserAttributeVerificationCodeResponse
@end
@interface AWSCognitoIdentityUserSetUserSettingsResponse : AWSCognitoIdentityProviderSetUserSettingsResponse
@end
NS_ASSUME_NONNULL_END