123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- //
- // Copyright 2014-2018 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 AWSCognitoIdentityUserMfaType;
- @class AWSCognitoIdentityUserMfaPreferences;
-
- @class AWSCognitoIdentityUserConfirmSignUpResponse;
- @class AWSCognitoIdentityUserGetDetailsResponse;
- @class AWSCognitoIdentityUserResendConfirmationCodeResponse;
- @class AWSCognitoIdentityUserForgotPasswordResponse;
- @class AWSCognitoIdentityUserConfirmForgotPasswordResponse;
- @class AWSCognitoIdentityUserChangePasswordResponse;
- @class AWSCognitoIdentityUserAttributeType;
- @class AWSCognitoIdentityUserUpdateAttributesResponse;
- @class AWSCognitoIdentityUserDeleteAttributesResponse;
- @class AWSCognitoIdentityUserVerifyAttributeResponse;
- @class AWSCognitoIdentityUserGetAttributeVerificationCodeResponse;
- @class AWSCognitoIdentityUserSetUserSettingsResponse;
- @class AWSCognitoIdentityUserGlobalSignOutResponse;
- @class AWSCognitoIdentityUserListDevicesResponse;
- @class AWSCognitoIdentityUserUpdateDeviceStatusResponse;
- @class AWSCognitoIdentityUserGetDeviceResponse;
- @class AWSCognitoIdentityUserSetUserMfaPreferenceResponse;
- @class AWSCognitoIdentityUserAssociateSoftwareTokenResponse;
- @class AWSCognitoIdentityUserVerifySoftwareTokenResponse;
-
- 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;
-
- /**
- Determines whether this user has an active session or not. If the refresh token is expired
- the user will be prompted to authenticate when you call getSession.
- */
- @property (nonatomic, readonly, getter=isSignedIn) BOOL signedIn;
-
- /**
- Get the device id
- */
- @property (nonatomic, readonly) NSString * deviceId;
-
- /**
- Confirm a users' sign up with the confirmation code
- */
- - (AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *)confirmSignUp:(NSString *)confirmationCode;
-
-
- /**
- Confirm a users' sign up with the confirmation code. If forceAliasCreation is set, if another user is aliased to the same email/phone this code was sent to, reassign alias to this user.
- */
- -(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode forceAliasCreation:(BOOL)forceAliasCreation;
-
- /**
- Resend the confirmation code sent during sign up
- */
- - (AWSTask<AWSCognitoIdentityUserResendConfirmationCodeResponse *> *)resendConfirmationCode;
-
- /**
- Get a session with id, access and refresh tokens.
- */
- - (AWSTask<AWSCognitoIdentityUserSession *> *)getSession;
-
- /**
- Get a session with the following username and password
- */
- - (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
- password:(NSString *)password
- validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData;
-
- /**
- 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;
-
-
- /**
- Set the user mfa preference supercedes SetUserSettings
- */
- - (AWSTask<AWSCognitoIdentityUserSetUserMfaPreferenceResponse *> *)setUserMfaPreference:(AWSCognitoIdentityUserMfaPreferences *) preferences;
-
-
- /**
- Start the process of associating a software token
- */
- - (AWSTask<AWSCognitoIdentityUserAssociateSoftwareTokenResponse *> *) associateSoftwareToken;
-
- /**
- Complete the process of associating a software token by verifying the code and setting device friendly name
- */
- -(AWSTask<AWSCognitoIdentityUserVerifySoftwareTokenResponse *>*) verifySoftwareToken: (NSString*) userCode friendlyDeviceName: (NSString* _Nullable) friendlyDeviceName;
-
- /**
- Delete this user
- */
- - (AWSTask *)deleteUser;
-
- /**
- Remove all sessions from the keychain for this user. Last known user remains.
- */
- - (void)signOut;
-
- /**
- Invalidate any active sessions with the service. Last known user remains.
- */
- - (AWSTask<AWSCognitoIdentityUserGlobalSignOutResponse *> *) globalSignOut;
-
- /**
- Remove all sessions from the keychain for this user and clear last known user.
- */
- - (void) signOutAndClearLastKnownUser;
-
- /**
- Remove the id and access token from the keychain, but keep the refresh token.
- Use this when you have updated user attributes and want to refresh the id and access tokens.
- */
- - (void) clearSession;
-
-
- /**
- List devices for this user
- */
- - (AWSTask<AWSCognitoIdentityUserListDevicesResponse *> *) listDevices: (int) limit paginationToken:(NSString * _Nullable) paginationToken;
-
- /**
- Update device remembered status for a specific device id.
- */
- - (AWSTask<AWSCognitoIdentityUserUpdateDeviceStatusResponse *> *) updateDeviceStatus: (NSString *) deviceId remembered:(BOOL) remembered;
-
- /**
- Convenience method to update device remembered status for this device.
- */
- - (AWSTask<AWSCognitoIdentityUserUpdateDeviceStatusResponse *> *) updateDeviceStatus: (BOOL) remembered;
-
-
- /**
- Get device details for a specific deviceId.
- */
- - (AWSTask<AWSCognitoIdentityUserGetDeviceResponse *> *) getDevice: (NSString *) deviceId;
-
- /**
- Convenience method to get device details for this device.
- */
- - (AWSTask<AWSCognitoIdentityUserGetDeviceResponse *> *) getDevice;
-
-
- /**
- Forget (stop tracking) a specific deviceId.
- */
- - (AWSTask *) forgetDevice: (NSString *) deviceId;
-
- /**
- Forget (stop tracking) this device.
- */
- - (AWSTask *) forgetDevice;
-
-
- @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
-
- /**
- The raw JWT token as a string.
- **/
- @property (nonatomic, readonly) NSString * tokenString;
-
- /**
- A NSDictionary of claims in this token.
-
- @deprecated This property is incorrectly typed as a [String : String], but
- claim values may be of several different type.
- */
- @property (nonatomic, readonly) NSDictionary<NSString *, NSString*> * claims DEPRECATED_MSG_ATTRIBUTE("Use `tokenClaims` instead.");
-
- /**
- A Dictionary of claims in this token
- */
- @property (nonatomic, readonly) NSDictionary<NSString *, id> * tokenClaims;
-
- @end
-
- /**
- User settings. Currently only mfa options.
- */
- @interface AWSCognitoIdentityUserSettings : NSObject
-
- @property (nonatomic, copy) NSArray<AWSCognitoIdentityUserMFAOption *>* _Nullable mfaOptions;
-
- @end
-
-
- /**
- User MFA preferences. Replaces user settings for mfa
- */
- @interface AWSCognitoIdentityUserMfaPreferences : NSObject
-
- @property (nonatomic, strong) AWSCognitoIdentityUserMfaType* _Nullable smsMfa;
- @property (nonatomic, strong) AWSCognitoIdentityUserMfaType* _Nullable softwareTokenMfa;
-
- @end
-
- /**
- User settings. Currently only mfa options.
- */
- @interface AWSCognitoIdentityUserMfaType : NSObject
-
- @property (nonatomic, assign) BOOL enabled;
- @property (nonatomic, assign) BOOL preferred;
-
- - (instancetype) initWithEnabled:(BOOL) enabled preferred:(BOOL) preferred;
-
- @end
-
-
- @interface AWSCognitoIdentityUserMFAOption : NSObject
-
- @property (nonatomic, strong) NSString * attributeName;
- @property (nonatomic, assign) AWSCognitoIdentityProviderDeliveryMediumType deliveryMedium;
-
- @end
-
- @interface AWSCognitoIdentityUserAttributeType : AWSCognitoIdentityProviderAttributeType
- - (instancetype) initWithName:(NSString *) name value:(NSString *) value;
- @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
-
- @interface AWSCognitoIdentityUserGlobalSignOutResponse : AWSCognitoIdentityProviderGlobalSignOutResponse
-
- @end
-
- @interface AWSCognitoIdentityUserListDevicesResponse : AWSCognitoIdentityProviderListDevicesResponse
-
- @end
-
- @interface AWSCognitoIdentityUserUpdateDeviceStatusResponse : AWSCognitoIdentityProviderUpdateDeviceStatusResponse
-
- @end
-
- @interface AWSCognitoIdentityUserGetDeviceResponse : AWSCognitoIdentityProviderGetDeviceResponse
-
- @end
-
- @interface AWSCognitoIdentityUserVerifySoftwareTokenResponse : AWSCognitoIdentityProviderVerifySoftwareTokenResponse
-
- @end
-
- @interface AWSCognitoIdentityUserAssociateSoftwareTokenResponse : AWSCognitoIdentityProviderAssociateSoftwareTokenResponse
-
- @end
-
- @interface AWSCognitoIdentityUserSetUserMfaPreferenceResponse : AWSCognitoIdentityProviderSetUserMFAPreferenceResponse
-
- @end
-
- NS_ASSUME_NONNULL_END
|