@webiny/cognito 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0
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/Cognito.d.ts +52 -5
- package/Cognito.js +100 -25
- package/Cognito.js.map +1 -1
- package/admin/Cognito.d.ts +4 -2
- package/admin/Cognito.js +10 -49
- package/admin/Cognito.js.map +1 -1
- package/admin/CognitoLogin.js +8 -13
- package/admin/CognitoLogin.js.map +1 -1
- package/admin/DefaultCognitoSignInConfig.d.ts +23 -0
- package/admin/DefaultCognitoSignInConfig.js +51 -0
- package/admin/DefaultCognitoSignInConfig.js.map +1 -0
- package/admin/Extension.js +15 -14
- package/admin/Extension.js.map +1 -1
- package/admin/SignInExtension.d.ts +2 -0
- package/admin/SignInExtension.js +9 -0
- package/admin/SignInExtension.js.map +1 -0
- package/admin/federatedIdentityProviders.js +7 -6
- package/admin/federatedIdentityProviders.js.map +1 -1
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.d.ts +2 -2
- package/admin/presentation/Cognito/CognitoLoginScreen.js +56 -42
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +34 -2
- package/admin/presentation/Cognito/CognitoPresenter.js +410 -255
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.test.d.ts +1 -0
- package/admin/presentation/Cognito/CognitoPresenter.test.js +180 -0
- package/admin/presentation/Cognito/CognitoPresenter.test.js.map +1 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.d.ts +31 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js +5 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js.map +1 -0
- package/admin/presentation/Cognito/abstractions.d.ts +27 -1
- package/admin/presentation/Cognito/abstractions.js +2 -1
- package/admin/presentation/Cognito/abstractions.js.map +1 -1
- package/admin/presentation/Cognito/components/ConfirmTotpCode.d.ts +26 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js +45 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js.map +1 -0
- package/admin/presentation/Cognito/components/Divider.d.ts +19 -1
- package/admin/presentation/Cognito/components/Divider.js +13 -13
- package/admin/presentation/Cognito/components/Divider.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +22 -5
- package/admin/presentation/Cognito/components/FederatedLogin.js +38 -27
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedProviders.js +7 -10
- package/admin/presentation/Cognito/components/FederatedProviders.js.map +1 -1
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +20 -3
- package/admin/presentation/Cognito/components/FooterSignIn.js +10 -12
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/NoTenantAccess.d.ts +23 -0
- package/admin/presentation/Cognito/components/NoTenantAccess.js +10 -0
- package/admin/presentation/Cognito/components/NoTenantAccess.js.map +1 -0
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +19 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +35 -38
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +37 -40
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.js +46 -49
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SelectTenant.d.ts +26 -0
- package/admin/presentation/Cognito/components/SelectTenant.js +15 -0
- package/admin/presentation/Cognito/components/SelectTenant.js.map +1 -0
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/SetNewPassword.js +73 -73
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetupTotp.d.ts +25 -0
- package/admin/presentation/Cognito/components/SetupTotp.js +61 -0
- package/admin/presentation/Cognito/components/SetupTotp.js.map +1 -0
- package/admin/presentation/Cognito/components/SignIn.d.ts +19 -3
- package/admin/presentation/Cognito/components/SignIn.js +60 -60
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/View.d.ts +1 -1
- package/admin/presentation/Cognito/components/View.js +41 -60
- package/admin/presentation/Cognito/components/View.js.map +1 -1
- package/admin/presentation/Cognito/components/index.d.ts +330 -0
- package/admin/presentation/Cognito/components/index.js +33 -0
- package/admin/presentation/Cognito/components/index.js.map +1 -0
- package/admin/presentation/Cognito/feature.js +12 -11
- package/admin/presentation/Cognito/feature.js.map +1 -1
- package/admin/presentation/Cognito/signInFeature.d.ts +1 -0
- package/admin/presentation/Cognito/signInFeature.js +11 -0
- package/admin/presentation/Cognito/signInFeature.js.map +1 -0
- package/api/CognitoApiFeature.d.ts +4 -1
- package/api/CognitoApiFeature.js +21 -17
- package/api/CognitoApiFeature.js.map +1 -1
- package/api/domain/Username.js +5 -4
- package/api/domain/Username.js.map +1 -1
- package/api/domain/errors.d.ts +68 -0
- package/api/domain/errors.js +109 -56
- package/api/domain/errors.js.map +1 -1
- package/api/features/CheckEmail/CheckEmailUseCase.d.ts +16 -0
- package/api/features/CheckEmail/CheckEmailUseCase.js +47 -0
- package/api/features/CheckEmail/CheckEmailUseCase.js.map +1 -0
- package/api/features/CheckEmail/abstractions.d.ts +29 -0
- package/api/features/CheckEmail/abstractions.js +5 -0
- package/api/features/CheckEmail/abstractions.js.map +1 -0
- package/api/features/CheckEmail/feature.d.ts +4 -0
- package/api/features/CheckEmail/feature.js +11 -0
- package/api/features/CheckEmail/feature.js.map +1 -0
- package/api/features/CheckEmail/index.d.ts +2 -0
- package/api/features/CheckEmail/index.js +2 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.d.ts +2 -0
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +73 -51
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
- package/api/features/CognitoIdp/abstractions.d.ts +7 -1
- package/api/features/CognitoIdp/abstractions.js +2 -1
- package/api/features/CognitoIdp/abstractions.js.map +1 -1
- package/api/features/CognitoIdp/feature.d.ts +4 -1
- package/api/features/CognitoIdp/feature.js +6 -5
- package/api/features/CognitoIdp/feature.js.map +1 -1
- package/api/features/CognitoIdp/index.js +0 -2
- package/api/features/CognitoService/CognitoService.d.ts +2 -1
- package/api/features/CognitoService/CognitoService.js +108 -83
- package/api/features/CognitoService/CognitoService.js.map +1 -1
- package/api/features/CognitoService/abstractions.d.ts +13 -2
- package/api/features/CognitoService/abstractions.js +3 -5
- package/api/features/CognitoService/abstractions.js.map +1 -1
- package/api/features/CognitoService/adminDeleteSoftwareToken.d.ts +16 -0
- package/api/features/CognitoService/adminDeleteSoftwareToken.js +69 -0
- package/api/features/CognitoService/adminDeleteSoftwareToken.js.map +1 -0
- package/api/features/CognitoService/adminDeleteSoftwareToken.test.d.ts +1 -0
- package/api/features/CognitoService/adminDeleteSoftwareToken.test.js +91 -0
- package/api/features/CognitoService/adminDeleteSoftwareToken.test.js.map +1 -0
- package/api/features/CognitoService/feature.d.ts +4 -1
- package/api/features/CognitoService/feature.js +7 -6
- package/api/features/CognitoService/feature.js.map +1 -1
- package/api/features/CognitoService/index.js +0 -2
- package/api/features/CreateUser/CreateUserUseCase.d.ts +1 -2
- package/api/features/CreateUser/CreateUserUseCase.js +63 -89
- package/api/features/CreateUser/CreateUserUseCase.js.map +1 -1
- package/api/features/CreateUser/abstractions.d.ts +3 -1
- package/api/features/CreateUser/abstractions.js +2 -1
- package/api/features/CreateUser/abstractions.js.map +1 -1
- package/api/features/CreateUser/feature.d.ts +4 -1
- package/api/features/CreateUser/feature.js +6 -5
- package/api/features/CreateUser/feature.js.map +1 -1
- package/api/features/CreateUser/index.js +0 -2
- package/api/features/CreateUser/schema.d.ts +4 -36
- package/api/features/CreateUser/schema.js +14 -13
- package/api/features/CreateUser/schema.js.map +1 -1
- package/api/features/DeleteUser/DeleteUserUseCase.d.ts +5 -3
- package/api/features/DeleteUser/DeleteUserUseCase.js +44 -42
- package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -1
- package/api/features/DeleteUser/abstractions.d.ts +2 -0
- package/api/features/DeleteUser/abstractions.js +2 -1
- package/api/features/DeleteUser/abstractions.js.map +1 -1
- package/api/features/DeleteUser/feature.d.ts +4 -1
- package/api/features/DeleteUser/feature.js +6 -5
- package/api/features/DeleteUser/feature.js.map +1 -1
- package/api/features/DeleteUser/index.js +0 -2
- package/api/features/LinkUser/LinkUserUseCase.d.ts +22 -0
- package/api/features/LinkUser/LinkUserUseCase.js +83 -0
- package/api/features/LinkUser/LinkUserUseCase.js.map +1 -0
- package/api/features/LinkUser/abstractions.d.ts +36 -0
- package/api/features/LinkUser/abstractions.js +5 -0
- package/api/features/LinkUser/abstractions.js.map +1 -0
- package/api/features/LinkUser/feature.d.ts +4 -0
- package/api/features/LinkUser/feature.js +11 -0
- package/api/features/LinkUser/feature.js.map +1 -0
- package/api/features/LinkUser/index.d.ts +2 -0
- package/api/features/LinkUser/index.js +2 -0
- package/api/features/ResetUserMfa/ResetUserMfaUseCase.d.ts +18 -0
- package/api/features/ResetUserMfa/ResetUserMfaUseCase.js +59 -0
- package/api/features/ResetUserMfa/ResetUserMfaUseCase.js.map +1 -0
- package/api/features/ResetUserMfa/abstractions.d.ts +24 -0
- package/api/features/ResetUserMfa/abstractions.js +5 -0
- package/api/features/ResetUserMfa/abstractions.js.map +1 -0
- package/api/features/ResetUserMfa/feature.d.ts +4 -0
- package/api/features/ResetUserMfa/feature.js +11 -0
- package/api/features/ResetUserMfa/feature.js.map +1 -0
- package/api/features/ResetUserMfa/index.d.ts +2 -0
- package/api/features/ResetUserMfa/index.js +2 -0
- package/api/features/UpdateUser/UpdateUserUseCase.d.ts +15 -3
- package/api/features/UpdateUser/UpdateUserUseCase.js +119 -70
- package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -1
- package/api/features/UpdateUser/abstractions.d.ts +7 -1
- package/api/features/UpdateUser/abstractions.js +2 -1
- package/api/features/UpdateUser/abstractions.js.map +1 -1
- package/api/features/UpdateUser/feature.d.ts +4 -1
- package/api/features/UpdateUser/feature.js +6 -5
- package/api/features/UpdateUser/feature.js.map +1 -1
- package/api/features/UpdateUser/index.js +0 -2
- package/api/features/UpdateUser/schema.d.ts +4 -34
- package/api/features/UpdateUser/schema.js +13 -12
- package/api/features/UpdateUser/schema.js.map +1 -1
- package/api/features/UserInstaller/UserInstaller.d.ts +5 -3
- package/api/features/UserInstaller/UserInstaller.js +53 -38
- package/api/features/UserInstaller/UserInstaller.js.map +1 -1
- package/api/features/UserInstaller/feature.d.ts +4 -1
- package/api/features/UserInstaller/feature.js +6 -5
- package/api/features/UserInstaller/feature.js.map +1 -1
- package/api/graphql/user.gql.d.ts +3 -2
- package/api/graphql/user.gql.js +178 -111
- package/api/graphql/user.gql.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/index.d.ts +0 -1
- package/index.js +0 -3
- package/infra/CognitoFederationPulumi.d.ts +8 -0
- package/infra/CognitoFederationPulumi.js +17 -0
- package/infra/CognitoFederationPulumi.js.map +1 -0
- package/package.json +38 -34
- package/admin/plugins/constants.d.ts +0 -3
- package/admin/plugins/constants.js +0 -6
- package/admin/plugins/constants.js.map +0 -1
- package/admin/plugins/permissionRenderer/AdminUsersPermissions.d.ts +0 -7
- package/admin/plugins/permissionRenderer/AdminUsersPermissions.js +0 -129
- package/admin/plugins/permissionRenderer/AdminUsersPermissions.js.map +0 -1
- package/admin/plugins/permissionRenderer/index.d.ts +0 -3
- package/admin/plugins/permissionRenderer/index.js +0 -20
- package/admin/plugins/permissionRenderer/index.js.map +0 -1
- package/admin/plugins/userMenu/AccountDetails.d.ts +0 -6
- package/admin/plugins/userMenu/AccountDetails.js +0 -23
- package/admin/plugins/userMenu/AccountDetails.js.map +0 -1
- package/admin/plugins/userMenu/useIsDefaultTenant.d.ts +0 -1
- package/admin/plugins/userMenu/useIsDefaultTenant.js +0 -15
- package/admin/plugins/userMenu/useIsDefaultTenant.js.map +0 -1
- package/admin/presentation/shared/createPasswordValidator.d.ts +0 -8
- package/admin/presentation/shared/createPasswordValidator.js +0 -27
- package/admin/presentation/shared/createPasswordValidator.js.map +0 -1
- package/admin/presentation/shared/usePasswordValidator.d.ts +0 -1
- package/admin/presentation/shared/usePasswordValidator.js +0 -15
- package/admin/presentation/shared/usePasswordValidator.js.map +0 -1
- package/admin/routes.d.ts +0 -10
- package/admin/routes.js +0 -21
- package/admin/routes.js.map +0 -1
- package/admin/ui/UserItem.d.ts +0 -10
- package/admin/ui/UserItem.js +0 -3
- package/admin/ui/UserItem.js.map +0 -1
- package/admin/ui/components/AvatarImage/AvatarImage.d.ts +0 -3
- package/admin/ui/components/AvatarImage/AvatarImage.js +0 -43
- package/admin/ui/components/AvatarImage/AvatarImage.js.map +0 -1
- package/admin/ui/components/AvatarImage/AvatarImagePreview.d.ts +0 -10
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js +0 -55
- package/admin/ui/components/AvatarImage/AvatarImagePreview.js.map +0 -1
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.d.ts +0 -7
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js +0 -29
- package/admin/ui/components/AvatarImage/AvatarImageTrigger.js.map +0 -1
- package/admin/ui/components/AvatarImage/index.d.ts +0 -1
- package/admin/ui/components/AvatarImage/index.js +0 -3
- package/admin/ui/components/AvatarImage/index.js.map +0 -1
- package/admin/ui/views/Account/Account.d.ts +0 -2
- package/admin/ui/views/Account/Account.js +0 -142
- package/admin/ui/views/Account/Account.js.map +0 -1
- package/admin/ui/views/Account/graphql.d.ts +0 -2
- package/admin/ui/views/Account/graphql.js +0 -40
- package/admin/ui/views/Account/graphql.js.map +0 -1
- package/admin/ui/views/Account/index.d.ts +0 -1
- package/admin/ui/views/Account/index.js +0 -3
- package/admin/ui/views/Account/index.js.map +0 -1
- package/admin/ui/views/Users/UsersDataList.d.ts +0 -3
- package/admin/ui/views/Users/UsersDataList.js +0 -172
- package/admin/ui/views/Users/UsersDataList.js.map +0 -1
- package/admin/ui/views/Users/UsersForm.d.ts +0 -5
- package/admin/ui/views/Users/UsersForm.js +0 -174
- package/admin/ui/views/Users/UsersForm.js.map +0 -1
- package/admin/ui/views/Users/UsersView.d.ts +0 -2
- package/admin/ui/views/Users/UsersView.js +0 -14
- package/admin/ui/views/Users/UsersView.js.map +0 -1
- package/admin/ui/views/Users/components/DeleteAction.d.ts +0 -7
- package/admin/ui/views/Users/components/DeleteAction.js +0 -36
- package/admin/ui/views/Users/components/DeleteAction.js.map +0 -1
- package/admin/ui/views/Users/graphql.d.ts +0 -5
- package/admin/ui/views/Users/graphql.js +0 -99
- package/admin/ui/views/Users/graphql.js.map +0 -1
- package/admin/ui/views/Users/hooks/useUserForm.d.ts +0 -27
- package/admin/ui/views/Users/hooks/useUserForm.js +0 -127
- package/admin/ui/views/Users/hooks/useUserForm.js.map +0 -1
- package/admin/ui/views/Users/search.svg +0 -20
- package/admin/ui/views/utils.d.ts +0 -3
- package/admin/ui/views/utils.js +0 -10
- package/admin/ui/views/utils.js.map +0 -1
- package/api/features/CognitoIdp/index.js.map +0 -1
- package/api/features/CognitoService/index.js.map +0 -1
- package/api/features/CreateUser/index.js.map +0 -1
- package/api/features/DeleteUser/index.js.map +0 -1
- package/api/features/UpdateUser/index.js.map +0 -1
- package/index.js.map +0 -1
package/Cognito.d.ts
CHANGED
|
@@ -1,8 +1,55 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const federationSchema: z.ZodObject<{
|
|
3
|
+
domain: z.ZodString;
|
|
4
|
+
callbackUrls: z.ZodArray<z.ZodString>;
|
|
5
|
+
logoutUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
+
responseType: z.ZodDefault<z.ZodEnum<{
|
|
7
|
+
code: "code";
|
|
8
|
+
token: "token";
|
|
9
|
+
}>>;
|
|
10
|
+
allowCredentialsLogin: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
identityProviders: z.ZodArray<z.ZodObject<{
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
amazon: "amazon";
|
|
14
|
+
apple: "apple";
|
|
15
|
+
facebook: "facebook";
|
|
16
|
+
google: "google";
|
|
17
|
+
oidc: "oidc";
|
|
18
|
+
}>;
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
label: z.ZodString;
|
|
21
|
+
providerDetails: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
22
|
+
idpIdentifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
2
26
|
export declare const Cognito: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<z.ZodObject<{
|
|
3
27
|
apiConfig: z.ZodOptional<z.ZodString>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
28
|
+
adminConfig: z.ZodOptional<z.ZodString>;
|
|
29
|
+
federation: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
30
|
+
domain: z.ZodString;
|
|
31
|
+
callbackUrls: z.ZodArray<z.ZodString>;
|
|
32
|
+
logoutUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
responseType: z.ZodDefault<z.ZodEnum<{
|
|
34
|
+
code: "code";
|
|
35
|
+
token: "token";
|
|
36
|
+
}>>;
|
|
37
|
+
allowCredentialsLogin: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
identityProviders: z.ZodArray<z.ZodObject<{
|
|
39
|
+
type: z.ZodEnum<{
|
|
40
|
+
amazon: "amazon";
|
|
41
|
+
apple: "apple";
|
|
42
|
+
facebook: "facebook";
|
|
43
|
+
google: "google";
|
|
44
|
+
oidc: "oidc";
|
|
45
|
+
}>;
|
|
46
|
+
name: z.ZodOptional<z.ZodString>;
|
|
47
|
+
label: z.ZodString;
|
|
48
|
+
providerDetails: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
49
|
+
idpIdentifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodCustom<() => Promise<z.infer<typeof federationSchema>>, () => Promise<z.infer<typeof federationSchema>>>]>>;
|
|
53
|
+
mfa: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
export {};
|
package/Cognito.js
CHANGED
|
@@ -1,30 +1,105 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
4
|
+
import { Admin } from "@webiny/project-aws/admin.js";
|
|
5
|
+
import { Infra } from "@webiny/project-aws/infra.js";
|
|
6
|
+
import { Await } from "@webiny/react-properties";
|
|
5
7
|
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}), /*#__PURE__*/React.createElement(Api.Extension, {
|
|
20
|
-
src: import.meta.dirname + "/api/CognitoApiFeature.js",
|
|
21
|
-
exportName: "CognitoApiFeature"
|
|
22
|
-
}), props.apiConfig ? /*#__PURE__*/React.createElement(Api.Extension, {
|
|
23
|
-
src: props.apiConfig
|
|
24
|
-
}) : null, /*#__PURE__*/React.createElement(Admin.Extension, {
|
|
25
|
-
src: import.meta.dirname + "/admin/Extension.js"
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
8
|
+
const identityProviderSchema = z.object({
|
|
9
|
+
type: z["enum"]([
|
|
10
|
+
"google",
|
|
11
|
+
"facebook",
|
|
12
|
+
"amazon",
|
|
13
|
+
"apple",
|
|
14
|
+
"oidc"
|
|
15
|
+
]),
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
label: z.string(),
|
|
18
|
+
providerDetails: z.record(z.string(), z.any()),
|
|
19
|
+
idpIdentifiers: z.array(z.string()).optional(),
|
|
20
|
+
attributeMapping: z.record(z.string(), z.string()).optional()
|
|
28
21
|
});
|
|
22
|
+
const federationSchema = z.object({
|
|
23
|
+
domain: z.string().describe("Cognito User Pool domain prefix."),
|
|
24
|
+
callbackUrls: z.array(z.string()).describe("OAuth callback URLs."),
|
|
25
|
+
logoutUrls: z.array(z.string()).optional(),
|
|
26
|
+
responseType: z["enum"]([
|
|
27
|
+
"code",
|
|
28
|
+
"token"
|
|
29
|
+
]).default("code"),
|
|
30
|
+
allowCredentialsLogin: z.boolean().default(true),
|
|
31
|
+
identityProviders: z.array(identityProviderSchema)
|
|
32
|
+
});
|
|
33
|
+
const Cognito = defineExtension({
|
|
34
|
+
type: "Project/Cognito",
|
|
35
|
+
tags: {
|
|
36
|
+
runtimeContext: "project",
|
|
37
|
+
hosting: "all"
|
|
38
|
+
},
|
|
39
|
+
description: "Enable and configure Cognito authentication.",
|
|
40
|
+
paramsSchema: z.object({
|
|
41
|
+
apiConfig: z.string().describe("Path to API configuration.").optional(),
|
|
42
|
+
adminConfig: z.string().describe("Path to Admin configuration.").optional(),
|
|
43
|
+
federation: z.union([
|
|
44
|
+
federationSchema,
|
|
45
|
+
z.custom((val)=>"function" == typeof val)
|
|
46
|
+
]).optional(),
|
|
47
|
+
mfa: z.boolean().describe("Enable TOTP MFA for all users.").default(false)
|
|
48
|
+
}),
|
|
49
|
+
render: (props)=>{
|
|
50
|
+
const federationProp = props.federation;
|
|
51
|
+
const federationFn = federationProp ? "function" == typeof federationProp ? federationProp : ()=>Promise.resolve(federationProp) : null;
|
|
52
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
53
|
+
varName: "REACT_APP_IDP_TYPE",
|
|
54
|
+
value: "cognito"
|
|
55
|
+
}), props.mfa ? /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
56
|
+
varName: "COGNITO_MFA",
|
|
57
|
+
value: "true"
|
|
58
|
+
}) : null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
59
|
+
src: import.meta.dirname + "/api/CognitoApiFeature.js",
|
|
60
|
+
exportName: "CognitoApiFeature"
|
|
61
|
+
}), props.apiConfig ? /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
62
|
+
src: props.apiConfig
|
|
63
|
+
}) : null, /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
64
|
+
src: import.meta.dirname + "/admin/Extension.js"
|
|
65
|
+
}), props.adminConfig ? /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
66
|
+
src: props.adminConfig
|
|
67
|
+
}) : null, federationFn ? /*#__PURE__*/ react.createElement(Await, {
|
|
68
|
+
fn: federationFn
|
|
69
|
+
}, (federation)=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
70
|
+
src: import.meta.dirname + "/admin/SignInExtension.js",
|
|
71
|
+
exportName: "SignInExtension"
|
|
72
|
+
}), /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
73
|
+
varName: "COGNITO_FEDERATION_INFRA_CONFIG",
|
|
74
|
+
value: JSON.stringify({
|
|
75
|
+
domain: federation.domain,
|
|
76
|
+
callbackUrls: federation.callbackUrls,
|
|
77
|
+
logoutUrls: federation.logoutUrls,
|
|
78
|
+
identityProviders: federation.identityProviders.map((idp)=>({
|
|
79
|
+
type: idp.type,
|
|
80
|
+
name: idp.name,
|
|
81
|
+
providerDetails: idp.providerDetails,
|
|
82
|
+
idpIdentifiers: idp.idpIdentifiers,
|
|
83
|
+
attributeMapping: idp.attributeMapping
|
|
84
|
+
}))
|
|
85
|
+
})
|
|
86
|
+
}), /*#__PURE__*/ react.createElement(Infra.Core.Pulumi, {
|
|
87
|
+
src: import.meta.dirname + "/infra/CognitoFederationPulumi.js"
|
|
88
|
+
}), /*#__PURE__*/ react.createElement(Admin.BuildParam, {
|
|
89
|
+
paramName: "cognitoFederation",
|
|
90
|
+
value: {
|
|
91
|
+
callbackUrls: federation.callbackUrls,
|
|
92
|
+
logoutUrls: federation.logoutUrls || federation.callbackUrls,
|
|
93
|
+
responseType: federation.responseType,
|
|
94
|
+
allowCredentialsLogin: federation.allowCredentialsLogin,
|
|
95
|
+
providers: federation.identityProviders.map((idp)=>({
|
|
96
|
+
name: idp.name || idp.type,
|
|
97
|
+
label: idp.label
|
|
98
|
+
}))
|
|
99
|
+
}
|
|
100
|
+
}))) : null);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export { Cognito };
|
|
29
104
|
|
|
30
105
|
//# sourceMappingURL=Cognito.js.map
|
package/Cognito.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Cognito.js","sources":["../src/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { Api } from \"@webiny/project-aws/api.js\";\nimport { Admin } from \"@webiny/project-aws/admin.js\";\nimport { Infra } from \"@webiny/project-aws/infra.js\";\nimport { Await } from \"@webiny/react-properties\";\nimport { z } from \"zod\";\n\nconst identityProviderSchema = z.object({\n type: z.enum([\"google\", \"facebook\", \"amazon\", \"apple\", \"oidc\"]),\n name: z.string().optional(),\n label: z.string(),\n providerDetails: z.record(z.string(), z.any()),\n idpIdentifiers: z.array(z.string()).optional(),\n attributeMapping: z.record(z.string(), z.string()).optional()\n});\n\nconst federationSchema = z.object({\n domain: z.string().describe(\"Cognito User Pool domain prefix.\"),\n callbackUrls: z.array(z.string()).describe(\"OAuth callback URLs.\"),\n logoutUrls: z.array(z.string()).optional(),\n responseType: z.enum([\"code\", \"token\"]).default(\"code\"),\n allowCredentialsLogin: z.boolean().default(true),\n identityProviders: z.array(identityProviderSchema)\n});\n\nexport const Cognito = defineExtension({\n type: \"Project/Cognito\",\n tags: { runtimeContext: \"project\", hosting: \"all\" },\n description: \"Enable and configure Cognito authentication.\",\n paramsSchema: z.object({\n apiConfig: z.string().describe(\"Path to API configuration.\").optional(),\n adminConfig: z.string().describe(\"Path to Admin configuration.\").optional(),\n federation: z\n .union([\n federationSchema,\n z.custom<() => Promise<z.infer<typeof federationSchema>>>(\n val => typeof val === \"function\"\n )\n ])\n .optional(),\n mfa: z.boolean().describe(\"Enable TOTP MFA for all users.\").default(false)\n }),\n render: props => {\n const federationProp = props.federation;\n const federationFn = federationProp\n ? typeof federationProp === \"function\"\n ? federationProp\n : () => Promise.resolve(federationProp)\n : null;\n\n return (\n <>\n <Infra.EnvVar varName={\"REACT_APP_IDP_TYPE\"} value={\"cognito\"} />\n {props.mfa ? <Infra.EnvVar varName={\"COGNITO_MFA\"} value={\"true\"} /> : null}\n\n {/* Api extensions */}\n <Api.Extension\n src={import.meta.dirname + \"/api/CognitoApiFeature.js\"}\n exportName={\"CognitoApiFeature\"}\n />\n {props.apiConfig ? <Api.Extension src={props.apiConfig} /> : null}\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n {props.adminConfig ? <Admin.Extension src={props.adminConfig} /> : null}\n\n {/* Federation infra + admin config */}\n {federationFn ? (\n <Await fn={federationFn}>\n {federation => (\n <>\n <Admin.Extension\n src={import.meta.dirname + \"/admin/SignInExtension.js\"}\n exportName={\"SignInExtension\"}\n />\n <Infra.EnvVar\n varName={\"COGNITO_FEDERATION_INFRA_CONFIG\"}\n value={JSON.stringify({\n domain: federation.domain,\n callbackUrls: federation.callbackUrls,\n logoutUrls: federation.logoutUrls,\n identityProviders: federation.identityProviders.map(\n idp => ({\n type: idp.type,\n name: idp.name,\n providerDetails: idp.providerDetails,\n idpIdentifiers: idp.idpIdentifiers,\n attributeMapping: idp.attributeMapping\n })\n )\n })}\n />\n <Infra.Core.Pulumi\n src={import.meta.dirname + \"/infra/CognitoFederationPulumi.js\"}\n />\n <Admin.BuildParam\n paramName={\"cognitoFederation\"}\n value={{\n callbackUrls: federation.callbackUrls,\n logoutUrls:\n federation.logoutUrls || federation.callbackUrls,\n responseType: federation.responseType,\n allowCredentialsLogin: federation.allowCredentialsLogin,\n providers: federation.identityProviders.map(idp => ({\n name: idp.name || idp.type,\n label: idp.label\n }))\n }}\n />\n </>\n )}\n </Await>\n ) : null}\n </>\n );\n }\n});\n"],"names":["identityProviderSchema","z","federationSchema","Cognito","defineExtension","val","props","federationProp","federationFn","Promise","Infra","Api","Admin","Await","federation","JSON","idp"],"mappings":"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"}
|
package/admin/Cognito.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { CognitoLoginProps } from "./CognitoLogin.js";
|
|
3
3
|
export interface CognitoAdminProps {
|
|
4
4
|
login: CognitoLoginProps;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
declare const CognitoIdP: (props: CognitoAdminProps) => React.JSX.Element;
|
|
7
|
+
export declare const CognitoAdmin: React.MemoExoticComponent<typeof CognitoIdP>;
|
|
8
|
+
export {};
|
package/admin/Cognito.js
CHANGED
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { plugins } from "@webiny/plugins";
|
|
4
|
-
import { HasPermission } from "@webiny/app-admin";
|
|
5
|
-
import { useRouter } from "@webiny/app-admin";
|
|
6
|
-
import { Permission } from "./plugins/constants.js";
|
|
7
|
-
import { UsersView } from "./ui/views/Users/UsersView.js";
|
|
8
|
-
import { UserAccountForm } from "./ui/views/Account/index.js";
|
|
9
|
-
import { AccountDetails } from "./plugins/userMenu/AccountDetails.js";
|
|
10
|
-
import permissionRenderer from "./plugins/permissionRenderer/index.js";
|
|
1
|
+
import react, { Fragment, memo } from "react";
|
|
2
|
+
import { AdminUsers } from "@webiny/app-admin";
|
|
11
3
|
import { CognitoLogin } from "./CognitoLogin.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Menu
|
|
16
|
-
} = AdminConfig;
|
|
17
|
-
const CognitoIdP = props => {
|
|
18
|
-
const {
|
|
19
|
-
getLink
|
|
20
|
-
} = useRouter();
|
|
21
|
-
plugins.register([permissionRenderer]);
|
|
22
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CognitoLogin, props.login), /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
23
|
-
name: Permission.Users
|
|
24
|
-
}, /*#__PURE__*/React.createElement(Route, {
|
|
25
|
-
route: Routes.Users.List,
|
|
26
|
-
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
27
|
-
title: "Admin Users"
|
|
28
|
-
}, /*#__PURE__*/React.createElement(UsersView, null))
|
|
29
|
-
}), /*#__PURE__*/React.createElement(Route, {
|
|
30
|
-
route: Routes.Users.Account,
|
|
31
|
-
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
32
|
-
title: "User Account"
|
|
33
|
-
}, /*#__PURE__*/React.createElement(UserAccountForm, null))
|
|
34
|
-
}), /*#__PURE__*/React.createElement(Menu, {
|
|
35
|
-
name: "cognito.settings.adminUsers",
|
|
36
|
-
parent: "settings",
|
|
37
|
-
after: "security.settings",
|
|
38
|
-
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
39
|
-
text: "Users",
|
|
40
|
-
to: getLink(Routes.Users.List),
|
|
41
|
-
pinnable: true
|
|
42
|
-
})
|
|
43
|
-
})), /*#__PURE__*/React.createElement(Menu.User, {
|
|
44
|
-
name: "accountSettings",
|
|
45
|
-
after: "userInfo",
|
|
46
|
-
element: /*#__PURE__*/React.createElement(AccountDetails, {
|
|
47
|
-
accountRoute: getLink(Routes.Users.Account)
|
|
48
|
-
})
|
|
49
|
-
})));
|
|
4
|
+
const ADMIN_USERS_CAPABILITIES = {
|
|
5
|
+
linkAccounts: true,
|
|
6
|
+
resetMfa: true
|
|
50
7
|
};
|
|
51
|
-
|
|
8
|
+
const CognitoIdP = (props)=>/*#__PURE__*/ react.createElement(Fragment, null, /*#__PURE__*/ react.createElement(CognitoLogin, props.login), /*#__PURE__*/ react.createElement(AdminUsers, {
|
|
9
|
+
capabilities: ADMIN_USERS_CAPABILITIES
|
|
10
|
+
}));
|
|
11
|
+
const CognitoAdmin = /*#__PURE__*/ memo(CognitoIdP);
|
|
12
|
+
export { CognitoAdmin };
|
|
52
13
|
|
|
53
14
|
//# sourceMappingURL=Cognito.js.map
|
package/admin/Cognito.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/Cognito.js","sources":["../../src/admin/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { Fragment } from \"react\";\nimport { memo } from \"react\";\nimport { AdminUsers } from \"@webiny/app-admin\";\nimport { CognitoLogin } from \"./CognitoLogin.js\";\nimport type { CognitoLoginProps } from \"./CognitoLogin.js\";\n\n/**\n * A Cognito account is shared by all of the person's tenants, and Cognito can drop a user's TOTP\n * token, so both are on.\n */\nconst ADMIN_USERS_CAPABILITIES = { linkAccounts: true, resetMfa: true };\n\nexport interface CognitoAdminProps {\n login: CognitoLoginProps;\n}\n\nconst CognitoIdP = (props: CognitoAdminProps) => {\n return (\n <Fragment>\n <CognitoLogin {...props.login} />\n <AdminUsers capabilities={ADMIN_USERS_CAPABILITIES} />\n </Fragment>\n );\n};\n\nexport const CognitoAdmin = memo(CognitoIdP);\n"],"names":["ADMIN_USERS_CAPABILITIES","CognitoIdP","props","Fragment","CognitoLogin","AdminUsers","CognitoAdmin","memo"],"mappings":";;;AAWA,MAAMA,2BAA2B;IAAE,cAAc;IAAM,UAAU;AAAK;AAMtE,MAAMC,aAAa,CAACC,QACT,WAAP,GACI,oBAACC,UAAQA,MAAAA,WAAAA,GACL,oBAACC,cAAiBF,MAAM,KAAK,iBAC7B,oBAACG,YAAUA;QAAC,cAAcL;;AAK/B,MAAMM,eAAe,WAAfA,GAAeC,KAAKN"}
|
package/admin/CognitoLogin.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react, { Fragment } from "react";
|
|
2
2
|
import { LoginScreenRenderer } from "@webiny/app-admin";
|
|
3
3
|
import { CognitoLoginScreen } from "./presentation/Cognito/CognitoLoginScreen.js";
|
|
4
|
-
const createLoginScreenPlugin = params
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export const CognitoLogin = props => {
|
|
14
|
-
const LoginScreenPlugin = createLoginScreenPlugin(props);
|
|
15
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(LoginScreenPlugin, null));
|
|
4
|
+
const createLoginScreenPlugin = (params)=>LoginScreenRenderer.createDecorator(()=>function({ children }) {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(CognitoLoginScreen, params, children);
|
|
6
|
+
});
|
|
7
|
+
const CognitoLogin_CognitoLogin = (props)=>{
|
|
8
|
+
const LoginScreenPlugin = createLoginScreenPlugin(props);
|
|
9
|
+
return /*#__PURE__*/ react.createElement(Fragment, null, /*#__PURE__*/ react.createElement(LoginScreenPlugin, null));
|
|
16
10
|
};
|
|
11
|
+
export { CognitoLogin_CognitoLogin as CognitoLogin };
|
|
17
12
|
|
|
18
13
|
//# sourceMappingURL=CognitoLogin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/CognitoLogin.js","sources":["../../src/admin/CognitoLogin.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { LoginScreenRenderer } from \"@webiny/app-admin\";\nimport {\n CognitoLoginScreen,\n type CognitoLoginScreenProps\n} from \"./presentation/Cognito/CognitoLoginScreen.js\";\n\nconst createLoginScreenPlugin = (params: Omit<CognitoLoginScreenProps, \"children\">) => {\n return LoginScreenRenderer.createDecorator(() => {\n return function CognitoLogin({ children }) {\n return <CognitoLoginScreen {...params}>{children}</CognitoLoginScreen>;\n };\n });\n};\n\nexport interface CognitoLoginProps {\n region: string;\n userPoolId: string;\n clientId: string;\n}\n\nexport const CognitoLogin = (props: CognitoLoginProps) => {\n const LoginScreenPlugin = createLoginScreenPlugin(props);\n return (\n <Fragment>\n <LoginScreenPlugin />\n </Fragment>\n );\n};\n"],"names":["createLoginScreenPlugin","params","LoginScreenRenderer","children","CognitoLoginScreen","CognitoLogin","props","LoginScreenPlugin","Fragment"],"mappings":";;;AAOA,MAAMA,0BAA0B,CAACC,SACtBC,oBAAoB,eAAe,CAAC,IAChC,SAAsB,EAAEC,QAAQ,EAAE;YACrC,OAAO,WAAP,GAAO,oBAACC,oBAAuBH,QAASE;QAC5C;AAUD,MAAME,4BAAe,CAACC;IACzB,MAAMC,oBAAoBP,wBAAwBM;IAClD,OAAO,WAAP,GACI,oBAACE,UAAQA,MAAAA,WAAAA,GACL,oBAACD,mBAAAA;AAGb"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BuildParams } from "@webiny/app-admin/features/buildParams/index.js";
|
|
2
|
+
import { type ICognitoSignInConfig } from "./presentation/Cognito/CognitoSignInConfig.js";
|
|
3
|
+
declare class DefaultCognitoSignInConfigImpl implements ICognitoSignInConfig {
|
|
4
|
+
private buildParams;
|
|
5
|
+
constructor(buildParams: BuildParams.Interface);
|
|
6
|
+
getConfig(): Promise<{
|
|
7
|
+
oauth: {
|
|
8
|
+
scopes: string[];
|
|
9
|
+
redirectSignIn: string[];
|
|
10
|
+
redirectSignOut: string[];
|
|
11
|
+
responseType: "code" | "token";
|
|
12
|
+
};
|
|
13
|
+
allowCredentialsLogin: boolean;
|
|
14
|
+
providers: {
|
|
15
|
+
name: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}[];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DefaultCognitoSignInConfig: typeof DefaultCognitoSignInConfigImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<ICognitoSignInConfig>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BuildParams } from "@webiny/app-admin/features/buildParams/index.js";
|
|
2
|
+
import { CognitoSignInConfig } from "./presentation/Cognito/CognitoSignInConfig.js";
|
|
3
|
+
class DefaultCognitoSignInConfigImpl {
|
|
4
|
+
constructor(buildParams){
|
|
5
|
+
this.buildParams = buildParams;
|
|
6
|
+
}
|
|
7
|
+
async getConfig() {
|
|
8
|
+
const config = this.buildParams.get("cognitoFederation");
|
|
9
|
+
if (!config) return {
|
|
10
|
+
oauth: {
|
|
11
|
+
scopes: [
|
|
12
|
+
"profile",
|
|
13
|
+
"email",
|
|
14
|
+
"openid"
|
|
15
|
+
],
|
|
16
|
+
redirectSignIn: [
|
|
17
|
+
window.location.origin
|
|
18
|
+
],
|
|
19
|
+
redirectSignOut: [
|
|
20
|
+
window.location.origin
|
|
21
|
+
],
|
|
22
|
+
responseType: "code"
|
|
23
|
+
},
|
|
24
|
+
allowCredentialsLogin: true,
|
|
25
|
+
providers: []
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
oauth: {
|
|
29
|
+
scopes: [
|
|
30
|
+
"profile",
|
|
31
|
+
"email",
|
|
32
|
+
"openid"
|
|
33
|
+
],
|
|
34
|
+
redirectSignIn: config.callbackUrls,
|
|
35
|
+
redirectSignOut: config.logoutUrls,
|
|
36
|
+
responseType: config.responseType
|
|
37
|
+
},
|
|
38
|
+
allowCredentialsLogin: config.allowCredentialsLogin,
|
|
39
|
+
providers: config.providers
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const DefaultCognitoSignInConfig = CognitoSignInConfig.createImplementation({
|
|
44
|
+
implementation: DefaultCognitoSignInConfigImpl,
|
|
45
|
+
dependencies: [
|
|
46
|
+
BuildParams
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
export { DefaultCognitoSignInConfig };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=DefaultCognitoSignInConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/DefaultCognitoSignInConfig.js","sources":["../../src/admin/DefaultCognitoSignInConfig.ts"],"sourcesContent":["import { BuildParams } from \"@webiny/app-admin/features/buildParams/index.js\";\nimport {\n CognitoSignInConfig,\n type ICognitoSignInConfig\n} from \"./presentation/Cognito/CognitoSignInConfig.js\";\n\ninterface FederationBuildParam {\n callbackUrls: string[];\n logoutUrls: string[];\n responseType: \"code\" | \"token\";\n allowCredentialsLogin: boolean;\n providers: { name: string; label: string }[];\n}\n\nclass DefaultCognitoSignInConfigImpl implements ICognitoSignInConfig {\n constructor(private buildParams: BuildParams.Interface) {}\n\n async getConfig() {\n const config = this.buildParams.get<FederationBuildParam>(\"cognitoFederation\");\n\n if (!config) {\n return {\n oauth: {\n scopes: [\"profile\", \"email\", \"openid\"],\n redirectSignIn: [window.location.origin],\n redirectSignOut: [window.location.origin],\n responseType: \"code\" as const\n },\n allowCredentialsLogin: true,\n providers: []\n };\n }\n\n return {\n oauth: {\n scopes: [\"profile\", \"email\", \"openid\"],\n redirectSignIn: config.callbackUrls,\n redirectSignOut: config.logoutUrls,\n responseType: config.responseType\n },\n allowCredentialsLogin: config.allowCredentialsLogin,\n providers: config.providers\n };\n }\n}\n\nexport const DefaultCognitoSignInConfig = CognitoSignInConfig.createImplementation({\n implementation: DefaultCognitoSignInConfigImpl,\n dependencies: [BuildParams]\n});\n"],"names":["DefaultCognitoSignInConfigImpl","buildParams","config","window","DefaultCognitoSignInConfig","CognitoSignInConfig","BuildParams"],"mappings":";;AAcA,MAAMA;IACF,YAAoBC,WAAkC,CAAE;aAApCA,WAAW,GAAXA;IAAqC;IAEzD,MAAM,YAAY;QACd,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,GAAG,CAAuB;QAE1D,IAAI,CAACA,QACD,OAAO;YACH,OAAO;gBACH,QAAQ;oBAAC;oBAAW;oBAAS;iBAAS;gBACtC,gBAAgB;oBAACC,OAAO,QAAQ,CAAC,MAAM;iBAAC;gBACxC,iBAAiB;oBAACA,OAAO,QAAQ,CAAC,MAAM;iBAAC;gBACzC,cAAc;YAClB;YACA,uBAAuB;YACvB,WAAW,EAAE;QACjB;QAGJ,OAAO;YACH,OAAO;gBACH,QAAQ;oBAAC;oBAAW;oBAAS;iBAAS;gBACtC,gBAAgBD,OAAO,YAAY;gBACnC,iBAAiBA,OAAO,UAAU;gBAClC,cAAcA,OAAO,YAAY;YACrC;YACA,uBAAuBA,OAAO,qBAAqB;YACnD,WAAWA,OAAO,SAAS;QAC/B;IACJ;AACJ;AAEO,MAAME,6BAA6BC,oBAAoB,oBAAoB,CAAC;IAC/E,gBAAgBL;IAChB,cAAc;QAACM;KAAY;AAC/B"}
|
package/admin/Extension.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { RegisterFeature } from "@webiny/app-admin";
|
|
3
3
|
import { CognitoFeature } from "./presentation/Cognito/feature.js";
|
|
4
4
|
import { CognitoAdmin } from "./Cognito.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const Extension = ()=>{
|
|
6
|
+
const region = process.env.REACT_APP_USER_POOL_REGION || "";
|
|
7
|
+
const userPoolId = process.env.REACT_APP_USER_POOL_ID || "";
|
|
8
|
+
const clientId = process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID || "";
|
|
9
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
10
|
+
feature: CognitoFeature
|
|
11
|
+
}), /*#__PURE__*/ react.createElement(CognitoAdmin, {
|
|
12
|
+
login: {
|
|
13
|
+
region,
|
|
14
|
+
userPoolId,
|
|
15
|
+
clientId
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
18
|
};
|
|
19
|
+
export { Extension };
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=Extension.js.map
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { CognitoFeature } from \"./presentation/Cognito/feature.js\";\nimport { CognitoAdmin } from \"./Cognito.js\";\n\nexport const Extension = () => {\n const region = process.env.REACT_APP_USER_POOL_REGION || \"\";\n const userPoolId = process.env.REACT_APP_USER_POOL_ID || \"\";\n const clientId = process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID || \"\";\n\n return (\n <>\n <RegisterFeature feature={CognitoFeature} />\n <CognitoAdmin\n login={{\n region,\n userPoolId,\n clientId\n }}\n />\n </>\n );\n};\n"],"names":["Extension","region","process","userPoolId","clientId","RegisterFeature","CognitoFeature","CognitoAdmin"],"mappings":";;;;AAKO,MAAMA,YAAY;IACrB,MAAMC,SAASC,QAAQ,GAAG,CAAC,0BAA0B,IAAI;IACzD,MAAMC,aAAaD,QAAQ,GAAG,CAAC,sBAAsB,IAAI;IACzD,MAAME,WAAWF,QAAQ,GAAG,CAAC,iCAAiC,IAAI;IAElE,OAAO,WAAP,GACI,wDACI,oBAACG,iBAAeA;QAAC,SAASC;sBAC1B,oBAACC,cAAYA;QACT,OAAO;YACHN;YACAE;YACAC;QACJ;;AAIhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { RegisterFeature } from "@webiny/app-admin";
|
|
3
|
+
import { CognitoSignInFeature } from "./presentation/Cognito/signInFeature.js";
|
|
4
|
+
const SignInExtension = ()=>/*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
5
|
+
feature: CognitoSignInFeature
|
|
6
|
+
});
|
|
7
|
+
export { SignInExtension };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=SignInExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/SignInExtension.js","sources":["../../src/admin/SignInExtension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { CognitoSignInFeature } from \"./presentation/Cognito/signInFeature.js\";\n\nexport const SignInExtension = () => {\n return <RegisterFeature feature={CognitoSignInFeature} />;\n};\n"],"names":["SignInExtension","RegisterFeature","CognitoSignInFeature"],"mappings":";;;AAIO,MAAMA,kBAAkB,IACpB,WAAP,GAAO,oBAACC,iBAAeA;QAAC,SAASC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const federatedIdentityProviders = {
|
|
2
|
+
cognito: "COGNITO",
|
|
3
|
+
google: "Google",
|
|
4
|
+
facebook: "Facebook",
|
|
5
|
+
amazon: "LoginWithAmazon",
|
|
6
|
+
apple: "SignInWithApple"
|
|
7
7
|
};
|
|
8
|
+
export { federatedIdentityProviders };
|
|
8
9
|
|
|
9
10
|
//# sourceMappingURL=federatedIdentityProviders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"admin/federatedIdentityProviders.js","sources":["../../src/admin/federatedIdentityProviders.ts"],"sourcesContent":["import type React from \"react\";\n\nexport const federatedIdentityProviders: Record<string, string> = {\n cognito: \"COGNITO\",\n google: \"Google\",\n facebook: \"Facebook\",\n amazon: \"LoginWithAmazon\",\n apple: \"SignInWithApple\"\n};\n\nexport interface SignInProps {\n signIn: () => void;\n}\n\nexport type FederatedIdentityProvider = {\n name: string;\n component: React.FunctionComponent<SignInProps>;\n};\n"],"names":["federatedIdentityProviders"],"mappings":"AAEO,MAAMA,6BAAqD;IAC9D,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;AACX"}
|
package/admin/index.d.ts
ADDED
package/admin/index.js
ADDED
|
@@ -5,6 +5,6 @@ export interface CognitoLoginScreenProps {
|
|
|
5
5
|
clientId: string;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const CognitoLoginScreen: ((props: CognitoLoginScreenProps) => React.JSX.Element) & {
|
|
9
|
-
|
|
8
|
+
export declare const CognitoLoginScreen: ((props: CognitoLoginScreenProps) => React.JSX.Element) & React.NamedExoticComponent<CognitoLoginScreenProps> & {
|
|
9
|
+
readonly type: (props: CognitoLoginScreenProps) => React.JSX.Element;
|
|
10
10
|
};
|