@aws-amplify/auth 5.6.3 → 5.6.4-unstable.bdaee91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Auth.d.ts +81 -4
- package/lib/Auth.js +2252 -45
- package/lib/Auth.js.map +1 -1
- package/lib/OAuth/OAuth.d.ts +1 -1
- package/lib/OAuth/OAuth.js +9 -5
- package/lib/OAuth/OAuth.js.map +1 -1
- package/lib-esm/Auth.d.ts +81 -4
- package/lib-esm/Auth.js +2254 -47
- package/lib-esm/Auth.js.map +1 -1
- package/lib-esm/OAuth/OAuth.d.ts +1 -1
- package/lib-esm/OAuth/OAuth.js +10 -6
- package/lib-esm/OAuth/OAuth.js.map +1 -1
- package/package.json +6 -7
- package/src/Auth.ts +2410 -76
- package/src/OAuth/OAuth.ts +9 -10
- package/internals/package.json +0 -8
- package/lib/internals/InternalAuth.d.ts +0 -353
- package/lib/internals/InternalAuth.js +0 -2630
- package/lib/internals/InternalAuth.js.map +0 -1
- package/lib/internals/index.d.ts +0 -1
- package/lib/internals/index.js +0 -7
- package/lib/internals/index.js.map +0 -1
- package/lib/utils.d.ts +0 -3
- package/lib/utils.js +0 -15
- package/lib/utils.js.map +0 -1
- package/lib-esm/internals/InternalAuth.d.ts +0 -353
- package/lib-esm/internals/InternalAuth.js +0 -2628
- package/lib-esm/internals/InternalAuth.js.map +0 -1
- package/lib-esm/internals/index.d.ts +0 -1
- package/lib-esm/internals/index.js +0 -4
- package/lib-esm/internals/index.js.map +0 -1
- package/lib-esm/utils.d.ts +0 -3
- package/lib-esm/utils.js +0 -11
- package/lib-esm/utils.js.map +0 -1
- package/src/internals/InternalAuth.ts +0 -3270
- package/src/internals/index.ts +0 -3
- package/src/utils.ts +0 -27
package/lib/Auth.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import { FederatedResponse, SignUpParams, FederatedUser, ConfirmSignUpOptions, SignOutOpts, CurrentUserOpts, GetPreferredMFAOpts, SignInOpts, FederatedSignInOptionsCustom, LegacyProvider, FederatedSignInOptions, ClientMetaData } from './types';
|
|
1
|
+
import { AuthOptions, FederatedResponse, SignUpParams, FederatedUser, ConfirmSignUpOptions, SignOutOpts, CurrentUserOpts, GetPreferredMFAOpts, SignInOpts, FederatedSignInOptionsCustom, LegacyProvider, FederatedSignInOptions, ClientMetaData } from './types';
|
|
2
2
|
import { ICredentials } from '@aws-amplify/core';
|
|
3
|
-
import { ISignUpResult, CognitoUser, MFAOption, CognitoUserSession, CognitoUserAttribute } from 'amazon-cognito-identity-js';
|
|
3
|
+
import { ISignUpResult, CognitoUser, MFAOption, CognitoUserSession, CognitoUserAttribute, NodeCallback } from 'amazon-cognito-identity-js';
|
|
4
4
|
import { AuthError } from './Errors';
|
|
5
5
|
import { IAuthDevice } from './types/Auth';
|
|
6
|
-
import { InternalAuthClass } from './internals/InternalAuth';
|
|
7
6
|
/**
|
|
8
7
|
* Provide authentication steps
|
|
9
8
|
*/
|
|
10
|
-
export declare class AuthClass
|
|
9
|
+
export declare class AuthClass {
|
|
10
|
+
private _config;
|
|
11
|
+
private userPool;
|
|
12
|
+
private user;
|
|
13
|
+
private _oAuthHandler;
|
|
14
|
+
private _storage;
|
|
15
|
+
private _storageSync;
|
|
16
|
+
private oAuthFlowInProgress;
|
|
17
|
+
private pendingSignIn;
|
|
18
|
+
private autoSignInInitiated;
|
|
19
|
+
private inflightSessionPromise;
|
|
20
|
+
private inflightSessionPromiseCounter;
|
|
21
|
+
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
22
|
+
/**
|
|
23
|
+
* Initialize Auth with AWS configurations
|
|
24
|
+
* @param {Object} config - Configuration of the Auth
|
|
25
|
+
*/
|
|
26
|
+
constructor(config: AuthOptions);
|
|
11
27
|
getModuleName(): string;
|
|
28
|
+
configure(config?: any): AuthOptions;
|
|
29
|
+
wrapRefreshSessionCallback: (callback: NodeCallback<Error, any>) => NodeCallback<Error, any>;
|
|
12
30
|
/**
|
|
13
31
|
* Sign up with username, password and other attributes like phone, email
|
|
14
32
|
* @param {String | object} params - The user attributes used for signin
|
|
@@ -16,6 +34,10 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
16
34
|
* @return - A promise resolves callback data if success
|
|
17
35
|
*/
|
|
18
36
|
signUp(params: string | SignUpParams, ...restOfAttrs: string[]): Promise<ISignUpResult>;
|
|
37
|
+
private handleAutoSignIn;
|
|
38
|
+
private handleCodeAutoSignIn;
|
|
39
|
+
private handleLinkAutoSignIn;
|
|
40
|
+
private signInAfterUserConfirmed;
|
|
19
41
|
/**
|
|
20
42
|
* Send the verification code to confirm sign up
|
|
21
43
|
* @param {String} username - The username to be confirmed
|
|
@@ -24,6 +46,7 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
24
46
|
* @return - A promise resolves callback data if success
|
|
25
47
|
*/
|
|
26
48
|
confirmSignUp(username: string, code: string, options?: ConfirmSignUpOptions): Promise<any>;
|
|
49
|
+
private isTrueStorageValue;
|
|
27
50
|
/**
|
|
28
51
|
* Resend the verification code
|
|
29
52
|
* @param {String} username - The username to be confirmed
|
|
@@ -39,6 +62,28 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
39
62
|
* @return - A promise resolves the CognitoUser
|
|
40
63
|
*/
|
|
41
64
|
signIn(usernameOrSignInOpts: string | SignInOpts, pw?: string, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
65
|
+
/**
|
|
66
|
+
* Return an object with the authentication callbacks
|
|
67
|
+
* @param {CognitoUser} user - the cognito user object
|
|
68
|
+
* @param {} resolve - function called when resolving the current step
|
|
69
|
+
* @param {} reject - function called when rejecting the current step
|
|
70
|
+
* @return - an object with the callback methods for user authentication
|
|
71
|
+
*/
|
|
72
|
+
private authCallbacks;
|
|
73
|
+
/**
|
|
74
|
+
* Sign in with a password
|
|
75
|
+
* @private
|
|
76
|
+
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
77
|
+
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
78
|
+
*/
|
|
79
|
+
private signInWithPassword;
|
|
80
|
+
/**
|
|
81
|
+
* Sign in without a password
|
|
82
|
+
* @private
|
|
83
|
+
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
84
|
+
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
85
|
+
*/
|
|
86
|
+
private signInWithoutPassword;
|
|
42
87
|
/**
|
|
43
88
|
* This was previously used by an authenticated user to get MFAOptions,
|
|
44
89
|
* but no longer returns a meaningful response. Refer to the documentation for
|
|
@@ -54,6 +99,8 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
54
99
|
* @param {GetPreferredMFAOpts} params - options for getting the current user preferred MFA
|
|
55
100
|
*/
|
|
56
101
|
getPreferredMFA(user: CognitoUser | any, params?: GetPreferredMFAOpts): Promise<string>;
|
|
102
|
+
private _getMfaTypeFromUserData;
|
|
103
|
+
private _getUserData;
|
|
57
104
|
/**
|
|
58
105
|
* set preferred MFA method
|
|
59
106
|
* @param {CognitoUser} user - the current Cognito user
|
|
@@ -118,6 +165,7 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
118
165
|
* @return {Promise}
|
|
119
166
|
**/
|
|
120
167
|
updateUserAttributes(user: CognitoUser | any, attributes: object, clientMetadata?: ClientMetaData): Promise<string>;
|
|
168
|
+
private createUpdateAttributesResultList;
|
|
121
169
|
/**
|
|
122
170
|
* Return user attributes
|
|
123
171
|
* @param {Object} user - The CognitoUser object
|
|
@@ -128,11 +176,22 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
128
176
|
verified: {};
|
|
129
177
|
unverified: {};
|
|
130
178
|
}>;
|
|
179
|
+
private isErrorWithMessage;
|
|
180
|
+
private isTokenRevokedError;
|
|
181
|
+
private isRefreshTokenRevokedError;
|
|
182
|
+
private isUserDisabledError;
|
|
183
|
+
private isUserDoesNotExistError;
|
|
184
|
+
private isRefreshTokenExpiredError;
|
|
185
|
+
private isPasswordResetRequiredError;
|
|
186
|
+
private isSignedInHostedUI;
|
|
187
|
+
private isSessionInvalid;
|
|
188
|
+
private cleanUpInvalidSession;
|
|
131
189
|
/**
|
|
132
190
|
* Get current authenticated user
|
|
133
191
|
* @return - A promise resolves to current authenticated CognitoUser if success
|
|
134
192
|
*/
|
|
135
193
|
currentUserPoolUser(params?: CurrentUserOpts): Promise<CognitoUser | any>;
|
|
194
|
+
private isOAuthInProgress;
|
|
136
195
|
/**
|
|
137
196
|
* Get current authenticated user
|
|
138
197
|
* @param {CurrentUserOpts} - options for getting the current user
|
|
@@ -144,6 +203,7 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
144
203
|
* @return - A promise resolves to session object if success
|
|
145
204
|
*/
|
|
146
205
|
currentSession(): Promise<CognitoUserSession>;
|
|
206
|
+
private _userSession;
|
|
147
207
|
/**
|
|
148
208
|
* Get the corresponding user session
|
|
149
209
|
* @param {Object} user - The CognitoUser object
|
|
@@ -179,12 +239,17 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
179
239
|
* @return - A promise resolves to callback data if success
|
|
180
240
|
*/
|
|
181
241
|
verifyCurrentUserAttributeSubmit(attr: string, code: string): Promise<string>;
|
|
242
|
+
private cognitoIdentitySignOut;
|
|
243
|
+
private oAuthSignOutRedirect;
|
|
244
|
+
private oAuthSignOutAndResolve;
|
|
245
|
+
private oAuthSignOutRedirectOrReject;
|
|
182
246
|
/**
|
|
183
247
|
* Sign out method
|
|
184
248
|
* @
|
|
185
249
|
* @return - A promise resolved if success
|
|
186
250
|
*/
|
|
187
251
|
signOut(opts?: SignOutOpts): Promise<any>;
|
|
252
|
+
private cleanCachedItems;
|
|
188
253
|
/**
|
|
189
254
|
* Change a password for an authenticated user
|
|
190
255
|
* @param {Object} user - The CognitoUser object
|
|
@@ -216,12 +281,24 @@ export declare class AuthClass extends InternalAuthClass {
|
|
|
216
281
|
federatedSignIn(options?: FederatedSignInOptions): Promise<ICredentials>;
|
|
217
282
|
federatedSignIn(provider: LegacyProvider, response: FederatedResponse, user: FederatedUser): Promise<ICredentials>;
|
|
218
283
|
federatedSignIn(options?: FederatedSignInOptionsCustom): Promise<ICredentials>;
|
|
284
|
+
/**
|
|
285
|
+
* Used to complete the OAuth flow with or without the Cognito Hosted UI
|
|
286
|
+
* @param {String} URL - optional parameter for customers to pass in the response URL
|
|
287
|
+
*/
|
|
288
|
+
private _handleAuthResponse;
|
|
219
289
|
/**
|
|
220
290
|
* Compact version of credentials
|
|
221
291
|
* @param {Object} credentials
|
|
222
292
|
* @return {Object} - Credentials
|
|
223
293
|
*/
|
|
224
294
|
essentialCredentials(credentials: any): ICredentials;
|
|
295
|
+
private attributesToObject;
|
|
296
|
+
private isTruthyString;
|
|
297
|
+
private createCognitoUser;
|
|
298
|
+
private _isValidAuthStorage;
|
|
299
|
+
private noUserPoolErrorHandler;
|
|
300
|
+
private rejectAuthError;
|
|
301
|
+
private rejectNoUserPool;
|
|
225
302
|
rememberDevice(): Promise<string | AuthError>;
|
|
226
303
|
forgetDevice(): Promise<void>;
|
|
227
304
|
fetchDevices(): Promise<IAuthDevice[]>;
|