UNPKG

2.98 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
6 * the License. A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0/
9 *
10 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
12 * and limitations under the License.
13 */
14Object.defineProperty(exports, "__esModule", { value: true });
15var CognitoHostedUIIdentityProvider;
16(function (CognitoHostedUIIdentityProvider) {
17 CognitoHostedUIIdentityProvider["Cognito"] = "COGNITO";
18 CognitoHostedUIIdentityProvider["Google"] = "Google";
19 CognitoHostedUIIdentityProvider["Facebook"] = "Facebook";
20 CognitoHostedUIIdentityProvider["Amazon"] = "LoginWithAmazon";
21 CognitoHostedUIIdentityProvider["Apple"] = "SignInWithApple";
22})(CognitoHostedUIIdentityProvider = exports.CognitoHostedUIIdentityProvider || (exports.CognitoHostedUIIdentityProvider = {}));
23function isFederatedSignInOptions(obj) {
24 var keys = ['provider'];
25 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
26}
27exports.isFederatedSignInOptions = isFederatedSignInOptions;
28function isFederatedSignInOptionsCustom(obj) {
29 var keys = ['customProvider'];
30 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
31}
32exports.isFederatedSignInOptionsCustom = isFederatedSignInOptionsCustom;
33function hasCustomState(obj) {
34 var keys = ['customState'];
35 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
36}
37exports.hasCustomState = hasCustomState;
38function isCognitoHostedOpts(oauth) {
39 return oauth.redirectSignIn !== undefined;
40}
41exports.isCognitoHostedOpts = isCognitoHostedOpts;
42var AuthErrorTypes;
43(function (AuthErrorTypes) {
44 AuthErrorTypes["NoConfig"] = "noConfig";
45 AuthErrorTypes["MissingAuthConfig"] = "missingAuthConfig";
46 AuthErrorTypes["EmptyUsername"] = "emptyUsername";
47 AuthErrorTypes["InvalidUsername"] = "invalidUsername";
48 AuthErrorTypes["EmptyPassword"] = "emptyPassword";
49 AuthErrorTypes["EmptyCode"] = "emptyCode";
50 AuthErrorTypes["SignUpError"] = "signUpError";
51 AuthErrorTypes["NoMFA"] = "noMFA";
52 AuthErrorTypes["InvalidMFA"] = "invalidMFA";
53 AuthErrorTypes["EmptyChallengeResponse"] = "emptyChallengeResponse";
54 AuthErrorTypes["NoUserSession"] = "noUserSession";
55 AuthErrorTypes["Default"] = "default";
56 AuthErrorTypes["DeviceConfig"] = "deviceConfig";
57 AuthErrorTypes["NetworkError"] = "networkError";
58})(AuthErrorTypes = exports.AuthErrorTypes || (exports.AuthErrorTypes = {}));
59function isUsernamePasswordOpts(obj) {
60 return !!obj.username;
61}
62exports.isUsernamePasswordOpts = isUsernamePasswordOpts;
63//# sourceMappingURL=Auth.js.map
\No newline at end of file