@baseplate-dev/plugin-auth 0.1.1
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/LICENSE +390 -0
- package/dist/auth/core/common.d.ts +7 -0
- package/dist/auth/core/common.d.ts.map +1 -0
- package/dist/auth/core/common.js +26 -0
- package/dist/auth/core/common.js.map +1 -0
- package/dist/auth/core/components/auth-definition-editor.d.ts +5 -0
- package/dist/auth/core/components/auth-definition-editor.d.ts.map +1 -0
- package/dist/auth/core/components/auth-definition-editor.js +57 -0
- package/dist/auth/core/components/auth-definition-editor.js.map +1 -0
- package/dist/auth/core/components/role-editor-form.d.ts +10 -0
- package/dist/auth/core/components/role-editor-form.d.ts.map +1 -0
- package/dist/auth/core/components/role-editor-form.js +27 -0
- package/dist/auth/core/components/role-editor-form.js.map +1 -0
- package/dist/auth/core/node.d.ts +5 -0
- package/dist/auth/core/node.d.ts.map +1 -0
- package/dist/auth/core/node.js +58 -0
- package/dist/auth/core/node.js.map +1 -0
- package/dist/auth/core/schema/models.d.ts +9 -0
- package/dist/auth/core/schema/models.d.ts.map +1 -0
- package/dist/auth/core/schema/models.js +187 -0
- package/dist/auth/core/schema/models.js.map +1 -0
- package/dist/auth/core/schema/plugin-definition.d.ts +88 -0
- package/dist/auth/core/schema/plugin-definition.d.ts.map +1 -0
- package/dist/auth/core/schema/plugin-definition.js +29 -0
- package/dist/auth/core/schema/plugin-definition.js.map +1 -0
- package/dist/auth/core/web.d.ts +6 -0
- package/dist/auth/core/web.d.ts.map +1 -0
- package/dist/auth/core/web.js +14 -0
- package/dist/auth/core/web.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts +65 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js +62 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.d.ts +96 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js +94 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/templates/management.ts +22 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session-payload.object-type.ts +23 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.mutations.ts +22 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.queries.ts +20 -0
- package/dist/auth/generators/fastify/auth-module/templates/services/user-session.service.ts +251 -0
- package/dist/auth/generators/fastify/auth-module/templates/user-session.constants.ts +19 -0
- package/dist/auth/generators/fastify/auth-module/templates/user-session.service.ts +101 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/cookie-signer.ts +71 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/session-cookie.ts +42 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/verify-request-origin.ts +45 -0
- package/dist/auth/generators/fastify/index.d.ts +2 -0
- package/dist/auth/generators/fastify/index.d.ts.map +1 -0
- package/dist/auth/generators/fastify/index.js +2 -0
- package/dist/auth/generators/fastify/index.js.map +1 -0
- package/dist/auth/generators/index.d.ts +2 -0
- package/dist/auth/generators/index.d.ts.map +1 -0
- package/dist/auth/generators/index.js +2 -0
- package/dist/auth/generators/index.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/metadata.json +8 -0
- package/dist/auth/static/icon.svg +1 -0
- package/dist/auth0/constants/packages.d.ts +6 -0
- package/dist/auth0/constants/packages.d.ts.map +1 -0
- package/dist/auth0/constants/packages.js +6 -0
- package/dist/auth0/constants/packages.js.map +1 -0
- package/dist/auth0/core/common.d.ts +7 -0
- package/dist/auth0/core/common.d.ts.map +1 -0
- package/dist/auth0/core/common.js +28 -0
- package/dist/auth0/core/common.js.map +1 -0
- package/dist/auth0/core/components/auth-definition-editor.d.ts +5 -0
- package/dist/auth0/core/components/auth-definition-editor.d.ts.map +1 -0
- package/dist/auth0/core/components/auth-definition-editor.js +57 -0
- package/dist/auth0/core/components/auth-definition-editor.js.map +1 -0
- package/dist/auth0/core/components/role-dialog.d.ts +14 -0
- package/dist/auth0/core/components/role-dialog.d.ts.map +1 -0
- package/dist/auth0/core/components/role-dialog.js +27 -0
- package/dist/auth0/core/components/role-dialog.js.map +1 -0
- package/dist/auth0/core/components/role-editor-form.d.ts +10 -0
- package/dist/auth0/core/components/role-editor-form.d.ts.map +1 -0
- package/dist/auth0/core/components/role-editor-form.js +52 -0
- package/dist/auth0/core/components/role-editor-form.js.map +1 -0
- package/dist/auth0/core/node.d.ts +5 -0
- package/dist/auth0/core/node.d.ts.map +1 -0
- package/dist/auth0/core/node.js +86 -0
- package/dist/auth0/core/node.js.map +1 -0
- package/dist/auth0/core/schema/migrations.d.ts +3 -0
- package/dist/auth0/core/schema/migrations.d.ts.map +1 -0
- package/dist/auth0/core/schema/migrations.js +17 -0
- package/dist/auth0/core/schema/migrations.js.map +1 -0
- package/dist/auth0/core/schema/models.d.ts +6 -0
- package/dist/auth0/core/schema/models.d.ts.map +1 -0
- package/dist/auth0/core/schema/models.js +33 -0
- package/dist/auth0/core/schema/models.js.map +1 -0
- package/dist/auth0/core/schema/plugin-definition.d.ts +73 -0
- package/dist/auth0/core/schema/plugin-definition.d.ts.map +1 -0
- package/dist/auth0/core/schema/plugin-definition.js +17 -0
- package/dist/auth0/core/schema/plugin-definition.js.map +1 -0
- package/dist/auth0/core/web.d.ts +6 -0
- package/dist/auth0/core/web.d.ts.map +1 -0
- package/dist/auth0/core/web.js +14 -0
- package/dist/auth0/core/web.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts +67 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js +125 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js +12 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.d.ts +43 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.js +25 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/templates/management.ts +22 -0
- package/dist/auth0/generators/fastify/auth0-module/templates/user-session.service.ts +101 -0
- package/dist/auth0/generators/fastify/index.d.ts +2 -0
- package/dist/auth0/generators/fastify/index.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/index.js +2 -0
- package/dist/auth0/generators/fastify/index.js.map +1 -0
- package/dist/auth0/generators/index.d.ts +3 -0
- package/dist/auth0/generators/index.d.ts.map +1 -0
- package/dist/auth0/generators/index.js +3 -0
- package/dist/auth0/generators/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts +10 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js +41 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/templates/auth-link.ts +11 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts +61 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js +59 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts +106 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.js +28 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/templates/auth0-callback.page.tsx +61 -0
- package/dist/auth0/generators/react/auth0-callback/templates/signup.page.tsx +48 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts +53 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js +44 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js +12 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts +45 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js +13 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/templates/RequireAuth.tsx +22 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts +28 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js +65 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts +8 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js +12 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js +16 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts +33 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js +50 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useCurrentUser.gql +10 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useCurrentUser.ts +29 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useLogOut.ts +14 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useRequiredUserId.ts +11 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useSession.ts +23 -0
- package/dist/auth0/generators/react/index.d.ts +6 -0
- package/dist/auth0/generators/react/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/index.js +6 -0
- package/dist/auth0/generators/react/index.js.map +1 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.d.ts +23 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js +64 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js.map +1 -0
- package/dist/auth0/metadata.json +8 -0
- package/dist/auth0/static/icon.svg +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/roles/constants.d.ts +4 -0
- package/dist/roles/constants.d.ts.map +1 -0
- package/dist/roles/constants.js +25 -0
- package/dist/roles/constants.js.map +1 -0
- package/dist/roles/index.d.ts +3 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +3 -0
- package/dist/roles/index.js.map +1 -0
- package/dist/roles/schema.d.ts +65 -0
- package/dist/roles/schema.d.ts.map +1 -0
- package/dist/roles/schema.js +43 -0
- package/dist/roles/schema.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/web/assets/__federation_expose_auth0CoreCommon--n6esVYP.js +54 -0
- package/dist/web/assets/__federation_expose_auth0CoreCommon--n6esVYP.js.map +1 -0
- package/dist/web/assets/__federation_expose_auth0CoreWeb-Ql6gpX5q.js +377 -0
- package/dist/web/assets/__federation_expose_auth0CoreWeb-Ql6gpX5q.js.map +1 -0
- package/dist/web/assets/__federation_fn_import-BiwmVFwy.js +421 -0
- package/dist/web/assets/__federation_fn_import-BiwmVFwy.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CY8oz43s.js +330 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CY8oz43s.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-B62IPizQ.js +10559 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-B62IPizQ.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BU2QTWNs.js +12718 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BU2QTWNs.js.map +1 -0
- package/dist/web/assets/__federation_shared_react-dom-Bwq4pLax.js +250 -0
- package/dist/web/assets/__federation_shared_react-dom-Bwq4pLax.js.map +1 -0
- package/dist/web/assets/__federation_shared_react-uocnGSER.js +7 -0
- package/dist/web/assets/__federation_shared_react-uocnGSER.js.map +1 -0
- package/dist/web/assets/__federation_shared_zod-BK7IELHt.js +4380 -0
- package/dist/web/assets/__federation_shared_zod-BK7IELHt.js.map +1 -0
- package/dist/web/assets/index-B1hOKVPw.js +574 -0
- package/dist/web/assets/index-B1hOKVPw.js.map +1 -0
- package/dist/web/assets/index-CgJx-krK.js +95 -0
- package/dist/web/assets/index-CgJx-krK.js.map +1 -0
- package/dist/web/assets/index-l0sNRNKZ.js.map +1 -0
- package/dist/web/assets/index.esm-BcxPd7Ha.js +2584 -0
- package/dist/web/assets/index.esm-BcxPd7Ha.js.map +1 -0
- package/dist/web/assets/model-utils-CbQJy1wE.js +1263 -0
- package/dist/web/assets/model-utils-CbQJy1wE.js.map +1 -0
- package/dist/web/assets/plugin-definition-BQRupXoQ.js +78 -0
- package/dist/web/assets/plugin-definition-BQRupXoQ.js.map +1 -0
- package/dist/web/assets/react-2jQE8aG0.js +47 -0
- package/dist/web/assets/react-2jQE8aG0.js.map +1 -0
- package/dist/web/assets/remoteEntry.js +54 -0
- package/dist/web/assets/remoteEntry.js.map +1 -0
- package/dist/web/assets/style-BdgwWjAf.css +95 -0
- package/dist/web/index.html +24 -0
- package/dist/web-export.d.ts +2 -0
- package/dist/web-export.js +2 -0
- package/dist/web-export.js.map +1 -0
- package/manifest.json +4 -0
- package/package.json +80 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import type { FastifyRequest } from 'fastify';
|
|
4
|
+
|
|
5
|
+
// Adapted from https://github.com/pilcrowonpaper/oslo/blob/main/src/request/index.ts
|
|
6
|
+
|
|
7
|
+
// Helper function to normalize host from URL
|
|
8
|
+
function getNormalizedHost(url: string): string | null {
|
|
9
|
+
try {
|
|
10
|
+
return new URL(
|
|
11
|
+
url.startsWith('http://') || url.startsWith('https://')
|
|
12
|
+
? url
|
|
13
|
+
: `https://${url}`,
|
|
14
|
+
).host.toLowerCase();
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Verifies if the request's origin is within the allowed hosts.
|
|
22
|
+
*
|
|
23
|
+
* @param req - The Fastify request object.
|
|
24
|
+
* @param allowedHosts - An array of allowed hostnames.
|
|
25
|
+
* @returns A boolean indicating whether the request's origin is allowed.
|
|
26
|
+
*/
|
|
27
|
+
export function verifyRequestOrigin(
|
|
28
|
+
req: FastifyRequest,
|
|
29
|
+
allowedHosts: string[],
|
|
30
|
+
): boolean {
|
|
31
|
+
const { origin } = req.headers;
|
|
32
|
+
if (!origin) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const originHost = getNormalizedHost(origin);
|
|
36
|
+
if (!originHost) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const normalizedAllowedHosts = allowedHosts
|
|
41
|
+
.map((host) => getNormalizedHost(host))
|
|
42
|
+
.filter(Boolean);
|
|
43
|
+
|
|
44
|
+
return normalizedAllowedHosts.includes(originHost);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/auth/generators/fastify/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/auth/generators/fastify/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/generators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/generators/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M120-160v-112q0-34 17.5-62.5T184-378q62-31 126-46.5T440-440q20 0 40 1.5t40 4.5q-4 58 21 109.5t73 84.5v80H120ZM760-40l-60-60v-186q-44-13-72-49.5T600-420q0-58 41-99t99-41q58 0 99 41t41 99q0 45-25.5 80T790-290l50 50-60 60 60 60-80 80ZM440-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm300 80q17 0 28.5-11.5T780-440q0-17-11.5-28.5T740-480q-17 0-28.5 11.5T700-440q0 17 11.5 28.5T740-400Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/auth0/constants/packages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;CAKjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/auth0/constants/packages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,sBAAsB,EAAE,OAAO;IAE/B,oBAAoB,EAAE,OAAO;CACrB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const _default: import("@baseplate-dev/project-builder-lib").PluginPlatformModule<{
|
|
2
|
+
config: import("@baseplate-dev/project-builder-lib").PluginSpecWithInitializer<import("@baseplate-dev/project-builder-lib").PluginConfigSpec>;
|
|
3
|
+
}, {
|
|
4
|
+
authConfig: import("@baseplate-dev/project-builder-lib").PluginSpec<import("@baseplate-dev/project-builder-lib").AuthConfigSpec>;
|
|
5
|
+
}>;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/auth0/core/common.ts"],"names":[],"mappings":";;;;;AAYA,wBA6BG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { authConfigSpec, createPlatformPluginExport, pluginConfigSpec, PluginUtils, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { AUTH0_PLUGIN_CONFIG_MIGRATIONS } from './schema/migrations.js';
|
|
3
|
+
import { auth0PluginDefinitionSchema } from './schema/plugin-definition.js';
|
|
4
|
+
export default createPlatformPluginExport({
|
|
5
|
+
dependencies: {
|
|
6
|
+
config: pluginConfigSpec,
|
|
7
|
+
},
|
|
8
|
+
exports: {
|
|
9
|
+
authConfig: authConfigSpec,
|
|
10
|
+
},
|
|
11
|
+
initialize: ({ config }, { pluginId }) => {
|
|
12
|
+
config.registerSchema(pluginId, auth0PluginDefinitionSchema);
|
|
13
|
+
config.registerMigrations(pluginId, AUTH0_PLUGIN_CONFIG_MIGRATIONS);
|
|
14
|
+
return {
|
|
15
|
+
authConfig: {
|
|
16
|
+
getUserModel: (definition) => {
|
|
17
|
+
const pluginConfig = PluginUtils.configByIdOrThrow(definition, pluginId);
|
|
18
|
+
return pluginConfig.modelRefs.user;
|
|
19
|
+
},
|
|
20
|
+
getAuthRoles: (definition) => {
|
|
21
|
+
const pluginConfig = PluginUtils.configByIdOrThrow(definition, pluginId);
|
|
22
|
+
return pluginConfig.roles;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/auth0/core/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAI5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,eAAe,0BAA0B,CAAC;IACxC,YAAY,EAAE;QACZ,MAAM,EAAE,gBAAgB;KACzB;IACD,OAAO,EAAE;QACP,UAAU,EAAE,cAAc;KAC3B;IACD,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;QAC7D,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC;QACpE,OAAO;YACL,UAAU,EAAE;gBACV,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE;oBAC3B,MAAM,YAAY,GAAG,WAAW,CAAC,iBAAiB,CAChD,UAAU,EACV,QAAQ,CACgB,CAAC;oBAC3B,OAAO,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC;gBACrC,CAAC;gBACD,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE;oBAC3B,MAAM,YAAY,GAAG,WAAW,CAAC,iBAAiB,CAChD,UAAU,EACV,QAAQ,CACgB,CAAC;oBAC3B,OAAO,YAAY,CAAC,KAAK,CAAC;gBAC5B,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WebConfigProps } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import '#src/styles.css';
|
|
4
|
+
export declare function AuthDefinitionEditor({ definition: pluginMetadata, metadata, onSave, }: WebConfigProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=auth-definition-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-definition-editor.d.ts","sourceRoot":"","sources":["../../../../src/auth0/core/components/auth-definition-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,iBAAiB,CAAC;AAEzB,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EAAE,cAAc,EAC1B,QAAQ,EACR,MAAM,GACP,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8HpC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { authRoleEntityType, createAndApplyModelMergerResults, createModelMergerResults, FeatureUtils, ModelUtils, PluginUtils, } from '@baseplate-dev/project-builder-lib';
|
|
3
|
+
import { FeatureComboboxFieldController, ModelComboboxFieldController, ModelMergerResultAlert, useBlockUnsavedChangesNavigate, useProjectDefinition, useResettableForm, } from '@baseplate-dev/project-builder-lib/web';
|
|
4
|
+
import { FormActionBar, SectionList, SectionListSection, SectionListSectionContent, SectionListSectionDescription, SectionListSectionHeader, SectionListSectionTitle, } from '@baseplate-dev/ui-components';
|
|
5
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { AUTH_DEFAULT_ROLES } from '#src/roles/index.js';
|
|
8
|
+
import { createAuth0Models } from '../schema/models.js';
|
|
9
|
+
import { auth0PluginDefinitionSchema } from '../schema/plugin-definition.js';
|
|
10
|
+
import RoleEditorForm from './role-editor-form.js';
|
|
11
|
+
import '#src/styles.css';
|
|
12
|
+
export function AuthDefinitionEditor({ definition: pluginMetadata, metadata, onSave, }) {
|
|
13
|
+
const { definition, definitionContainer, saveDefinitionWithFeedback } = useProjectDefinition();
|
|
14
|
+
const defaultValues = useMemo(() => {
|
|
15
|
+
if (pluginMetadata?.config) {
|
|
16
|
+
return pluginMetadata.config;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
modelRefs: {
|
|
20
|
+
user: ModelUtils.getModelIdByNameOrDefault(definition, 'User'),
|
|
21
|
+
},
|
|
22
|
+
authFeatureRef: FeatureUtils.getFeatureIdByNameOrDefault(definition, 'auth'),
|
|
23
|
+
roles: AUTH_DEFAULT_ROLES.map((r) => ({
|
|
24
|
+
...r,
|
|
25
|
+
id: authRoleEntityType.generateNewId(),
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
28
|
+
}, [definition, pluginMetadata?.config]);
|
|
29
|
+
const form = useResettableForm({
|
|
30
|
+
resolver: zodResolver(auth0PluginDefinitionSchema),
|
|
31
|
+
defaultValues,
|
|
32
|
+
});
|
|
33
|
+
const { control, reset, handleSubmit, watch } = form;
|
|
34
|
+
const modelRefs = watch('modelRefs');
|
|
35
|
+
const authFeatureRef = watch('authFeatureRef');
|
|
36
|
+
const pendingModelChanges = useMemo(() => {
|
|
37
|
+
const desiredModels = createAuth0Models({ modelRefs, authFeatureRef });
|
|
38
|
+
return createModelMergerResults(modelRefs, desiredModels, definitionContainer);
|
|
39
|
+
}, [definitionContainer, authFeatureRef, modelRefs]);
|
|
40
|
+
const onSubmit = handleSubmit((data) => saveDefinitionWithFeedback((draftConfig) => {
|
|
41
|
+
const featureRef = FeatureUtils.ensureFeatureByNameRecursively(draftConfig, data.authFeatureRef);
|
|
42
|
+
const updatedData = {
|
|
43
|
+
...data,
|
|
44
|
+
authFeatureRef: featureRef,
|
|
45
|
+
};
|
|
46
|
+
createAndApplyModelMergerResults(draftConfig, updatedData.modelRefs, createAuth0Models(updatedData), definitionContainer);
|
|
47
|
+
PluginUtils.setPluginConfig(draftConfig, metadata, updatedData, definitionContainer.pluginStore);
|
|
48
|
+
}, {
|
|
49
|
+
successMessage: 'Successfully saved Auth0 plugin!',
|
|
50
|
+
onSuccess: () => {
|
|
51
|
+
onSave();
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
useBlockUnsavedChangesNavigate({ control, reset, onSubmit });
|
|
55
|
+
return (_jsxs("form", { onSubmit: onSubmit, className: "max-w-6xl auth:mb-[--action-bar-height]", children: [_jsx("div", { className: "auth:pb-16", children: _jsxs(SectionList, { children: [_jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Auth0 Configuration" }), _jsx(SectionListSectionDescription, { children: "Configure your Auth0 authentication settings, user model, and role definitions." })] }), _jsxs(SectionListSectionContent, { className: "auth:space-y-6", children: [_jsx(ModelMergerResultAlert, { pendingModelChanges: pendingModelChanges }), _jsxs("div", { className: "md:auth:grid-cols-2 auth:grid auth:grid-cols-1 auth:gap-6", children: [_jsx(ModelComboboxFieldController, { label: "User Model", name: "modelRefs.user", control: control, canCreate: true, description: "Select or create the model that will store user authentication data" }), _jsx(FeatureComboboxFieldController, { label: "Auth Feature Path", name: "authFeatureRef", control: control, canCreate: true, description: "Specify the feature path where authentication endpoints will be generated" })] })] })] }), _jsx(RoleEditorForm, { control: control })] }) }), _jsx(FormActionBar, { form: form })] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=auth-definition-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-definition-editor.js","sourceRoot":"","sources":["../../../../src/auth0/core/components/auth-definition-editor.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,wBAAwB,EACxB,YAAY,EACZ,UAAU,EACV,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,sBAAsB,EACtB,8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C,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE7D,OAAO,CACL,gBACE,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,yCAAyC,aAEnD,cAAK,SAAS,EAAC,YAAY,YACzB,MAAC,WAAW,eACV,MAAC,kBAAkB,eACjB,MAAC,wBAAwB,eACvB,KAAC,uBAAuB,sCAEE,EAC1B,KAAC,6BAA6B,kGAGE,IACP,EAC3B,MAAC,yBAAyB,IAAC,SAAS,EAAC,gBAAgB,aACnD,KAAC,sBAAsB,IACrB,mBAAmB,EAAE,mBAAmB,GACxC,EAEF,eAAK,SAAS,EAAC,2DAA2D,aACxE,KAAC,4BAA4B,IAC3B,KAAK,EAAC,YAAY,EAClB,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,QACT,WAAW,EAAC,qEAAqE,GACjF,EACF,KAAC,8BAA8B,IAC7B,KAAK,EAAC,mBAAmB,EACzB,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,QACT,WAAW,EAAC,2EAA2E,GACvF,IACE,IACoB,IACT,EAErB,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,GAAI,IACxB,GACV,EAEN,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,GAAI,IACxB,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { AuthRoleInput } from '#src/roles/schema.js';
|
|
3
|
+
interface RoleDialogProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
role?: AuthRoleInput;
|
|
7
|
+
isNew?: boolean;
|
|
8
|
+
onSave: (role: AuthRoleInput) => void;
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function RoleDialog({ open, onOpenChange, role, isNew, onSave, asChild, children, }: RoleDialogProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=role-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-dialog.d.ts","sourceRoot":"","sources":["../../../../src/auth0/core/components/role-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,KAAa,EACb,MAAM,EACN,OAAO,EACP,QAAQ,GACT,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkErC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, InputFieldController, } from '@baseplate-dev/ui-components';
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import { useId } from 'react';
|
|
5
|
+
import { useForm } from 'react-hook-form';
|
|
6
|
+
import { authRoleSchema } from '#src/roles/schema.js';
|
|
7
|
+
export function RoleDialog({ open, onOpenChange, role, isNew = false, onSave, asChild, children, }) {
|
|
8
|
+
const form = useForm({
|
|
9
|
+
resolver: zodResolver(authRoleSchema),
|
|
10
|
+
values: role,
|
|
11
|
+
});
|
|
12
|
+
const { control, handleSubmit } = form;
|
|
13
|
+
const onSubmit = handleSubmit((data) => {
|
|
14
|
+
onSave(data);
|
|
15
|
+
onOpenChange?.(false);
|
|
16
|
+
});
|
|
17
|
+
const formId = useId();
|
|
18
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [_jsx(DialogTrigger, { asChild: asChild, children: children }), _jsx(DialogContent, { children: _jsxs("form", { id: formId, onSubmit: (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
return onSubmit(e);
|
|
21
|
+
}, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isNew ? 'Add Role' : 'Edit Role' }), _jsx(DialogDescription, { children: isNew
|
|
22
|
+
? 'Enter the details for the new role.'
|
|
23
|
+
: 'Update the role details below.' })] }), _jsxs("div", { className: "auth:space-y-4 auth:py-4", children: [_jsx(InputFieldController, { label: "Role Name", name: "name", control: control, placeholder: "Enter role name" }), _jsx(InputFieldController, { label: "Description", name: "comment", control: control, placeholder: "Describe this role's purpose" })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
24
|
+
onOpenChange?.(false);
|
|
25
|
+
}, children: "Cancel" }), _jsxs(Button, { form: formId, type: "submit", children: [isNew ? 'Add' : 'Update', " Role"] })] })] }) })] }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=role-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-dialog.js","sourceRoot":"","sources":["../../../../src/auth0/core/components/role-dialog.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,M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AAC,0BAA0B,aACvC,KAAC,oBAAoB,IACnB,KAAK,EAAC,WAAW,EACjB,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,WAAW,EAAC,iBAAiB,GAC7B,EACF,KAAC,oBAAoB,IACnB,KAAK,EAAC,aAAa,EACnB,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,OAAO,EAChB,WAAW,EAAC,8BAA8B,GAC1C,IACE,EACN,MAAC,YAAY,eACX,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE;wCACZ,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC;oCACxB,CAAC,uBAGM,EACT,MAAC,MAAM,IAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,QAAQ,aAChC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,aAClB,IACI,IACV,GACO,IACT,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { Control } from 'react-hook-form';
|
|
3
|
+
import type { Auth0PluginDefinitionInput } from '../schema/plugin-definition.js';
|
|
4
|
+
interface Props {
|
|
5
|
+
className?: string;
|
|
6
|
+
control: Control<Auth0PluginDefinitionInput>;
|
|
7
|
+
}
|
|
8
|
+
declare function RoleEditorForm({ className, control }: Props): React.JSX.Element;
|
|
9
|
+
export default RoleEditorForm;
|
|
10
|
+
//# sourceMappingURL=role-editor-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-editor-form.d.ts","sourceRoot":"","sources":["../../../../src/auth0/core/components/role-editor-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAuB/C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAIjF,UAAU,KAAK;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAC9C;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAmHxE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { authRoleEntityType } from '@baseplate-dev/project-builder-lib';
|
|
3
|
+
import { Badge, Button, RecordView, RecordViewActions, RecordViewItem, RecordViewItemList, SectionListSection, SectionListSectionContent, SectionListSectionDescription, SectionListSectionHeader, SectionListSectionTitle, useConfirmDialog, } from '@baseplate-dev/ui-components';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { useFieldArray, useWatch } from 'react-hook-form';
|
|
6
|
+
import { MdAdd, MdDeleteOutline, MdEdit } from 'react-icons/md';
|
|
7
|
+
import { RoleDialog } from './role-dialog.js';
|
|
8
|
+
function RoleEditorForm({ className, control }) {
|
|
9
|
+
const { requestConfirm } = useConfirmDialog();
|
|
10
|
+
const { append, update, remove } = useFieldArray({
|
|
11
|
+
control,
|
|
12
|
+
name: 'roles',
|
|
13
|
+
});
|
|
14
|
+
const [roleToEdit, setRoleToEdit] = useState();
|
|
15
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
16
|
+
const roles = useWatch({ control, name: 'roles' });
|
|
17
|
+
function handleSaveRole(newRole) {
|
|
18
|
+
const existingIndex = roles.findIndex((role) => role.id === newRole.id);
|
|
19
|
+
if (existingIndex === -1) {
|
|
20
|
+
append(newRole);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
update(existingIndex, newRole);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function handleDeleteRole(roleIdx) {
|
|
27
|
+
const role = roles[roleIdx];
|
|
28
|
+
requestConfirm({
|
|
29
|
+
title: 'Delete Role',
|
|
30
|
+
content: `Are you sure you want to delete the role "${role.name}"?`,
|
|
31
|
+
onConfirm: () => {
|
|
32
|
+
remove(roleIdx);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return (_jsxs(SectionListSection, { className: className, children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "User Roles" }), _jsx(SectionListSectionDescription, { children: "Define roles for your application. Default roles are protected and cannot be removed." })] }), _jsxs(SectionListSectionContent, { className: "auth:space-y-4", children: [roles.map((role, roleIdx) => (_jsxs(RecordView, { children: [_jsxs(RecordViewItemList, { children: [_jsx(RecordViewItem, { title: "Name", children: _jsx("div", { className: "auth:flex auth:items-center auth:gap-2", children: _jsx("span", { children: role.name }) }) }), _jsx(RecordViewItem, { title: "Description", children: role.comment.trim() || (_jsx("span", { className: "auth:text-muted-foreground", children: "No description" })) })] }), _jsxs(RecordViewActions, { children: [role.builtIn && _jsx(Badge, { variant: "secondary", children: "Default Role" }), !role.builtIn && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", size: "icon", title: "Edit", "aria-label": "Edit role", onClick: () => {
|
|
37
|
+
setRoleToEdit(role);
|
|
38
|
+
setIsEditing(true);
|
|
39
|
+
}, children: _jsx(MdEdit, {}) }), _jsx(Button, { variant: "ghostDestructive", size: "icon", title: "Delete", "aria-label": "Delete role", onClick: () => {
|
|
40
|
+
handleDeleteRole(roleIdx);
|
|
41
|
+
}, children: _jsx(MdDeleteOutline, {}) })] }))] })] }, role.id))), _jsx(RoleDialog, { open: isEditing, onOpenChange: setIsEditing, role: roleToEdit, isNew: roleToEdit ? !roles.some((r) => r.id === roleToEdit.id) : true, onSave: handleSaveRole }), _jsxs(Button, { variant: "secondary", size: "sm", onClick: () => {
|
|
42
|
+
setRoleToEdit({
|
|
43
|
+
id: authRoleEntityType.generateNewId(),
|
|
44
|
+
name: '',
|
|
45
|
+
comment: '',
|
|
46
|
+
builtIn: false,
|
|
47
|
+
});
|
|
48
|
+
setIsEditing(true);
|
|
49
|
+
}, children: [_jsx(MdAdd, {}), "Add Role"] })] })] }));
|
|
50
|
+
}
|
|
51
|
+
export default RoleEditorForm;
|
|
52
|
+
//# sourceMappingURL=role-editor-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-editor-form.js","sourceRoot":"","sources":["../../../../src/auth0/core/components/role-editor-form.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO9C,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAS;IACnD,MAAM,EAAE,cAAc,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAC/C,OAAO;QACP,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,EAA6B,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAA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AAC,CAAC;4BACH,YAAY,CAAC,IAAI,CAAC,CAAC;wBACrB,CAAC,aAED,KAAC,KAAK,KAAG,gBAEF,IACiB,IACT,CACtB,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const _default: import("@baseplate-dev/project-builder-lib").PluginPlatformModule<{
|
|
2
|
+
appCompiler: import("@baseplate-dev/project-builder-lib").PluginSpecWithInitializer<import("@baseplate-dev/project-builder-lib").AppCompilerSpec>;
|
|
3
|
+
}, {}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/auth0/core/node.ts"],"names":[],"mappings":";;;AA+BA,wBAuFG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { authContextGenerator, authPluginGenerator, authRolesGenerator, pothosAuthGenerator, userSessionTypesGenerator, } from '@baseplate-dev/fastify-generators';
|
|
2
|
+
import { adminAppEntryType, appCompilerSpec, backendAppEntryType, createPlatformPluginExport, PluginUtils, webAppEntryType, } from '@baseplate-dev/project-builder-lib';
|
|
3
|
+
import { authIdentifyGenerator, reactRoutesGenerator, } from '@baseplate-dev/react-generators';
|
|
4
|
+
import { auth0ApolloGenerator, auth0CallbackGenerator, auth0ComponentsGenerator, auth0HooksGenerator, auth0ModuleGenerator, reactAuth0Generator, } from '../generators/index.js';
|
|
5
|
+
export default createPlatformPluginExport({
|
|
6
|
+
dependencies: {
|
|
7
|
+
appCompiler: appCompilerSpec,
|
|
8
|
+
},
|
|
9
|
+
exports: {},
|
|
10
|
+
initialize: ({ appCompiler }, { pluginId }) => {
|
|
11
|
+
// register backend compiler
|
|
12
|
+
appCompiler.registerAppCompiler({
|
|
13
|
+
pluginId,
|
|
14
|
+
appType: backendAppEntryType,
|
|
15
|
+
compile: ({ projectDefinition, definitionContainer, appCompiler }) => {
|
|
16
|
+
const auth = PluginUtils.configByIdOrThrow(projectDefinition, pluginId);
|
|
17
|
+
appCompiler.addChildrenToFeature(auth.authFeatureRef, {
|
|
18
|
+
authContext: authContextGenerator({}),
|
|
19
|
+
authPlugin: authPluginGenerator({}),
|
|
20
|
+
authRoles: authRolesGenerator({
|
|
21
|
+
roles: auth.roles.map((r) => ({
|
|
22
|
+
name: r.name,
|
|
23
|
+
comment: r.comment,
|
|
24
|
+
builtIn: r.builtIn,
|
|
25
|
+
})),
|
|
26
|
+
}),
|
|
27
|
+
auth0Module: auth0ModuleGenerator({
|
|
28
|
+
userModelName: definitionContainer.nameFromId(auth.modelRefs.user),
|
|
29
|
+
includeManagement: true,
|
|
30
|
+
}),
|
|
31
|
+
userSessionTypes: userSessionTypesGenerator({}),
|
|
32
|
+
});
|
|
33
|
+
appCompiler.addRootChildren({
|
|
34
|
+
pothosAuth: pothosAuthGenerator({}),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// register web compiler
|
|
39
|
+
appCompiler.registerAppCompiler({
|
|
40
|
+
pluginId,
|
|
41
|
+
appType: webAppEntryType,
|
|
42
|
+
compile: ({ appCompiler }) => {
|
|
43
|
+
appCompiler.addRootChildren({
|
|
44
|
+
auth: reactAuth0Generator({
|
|
45
|
+
callbackPath: 'auth/auth0-callback',
|
|
46
|
+
}),
|
|
47
|
+
authHooks: auth0HooksGenerator({}),
|
|
48
|
+
authIdentify: authIdentifyGenerator({}),
|
|
49
|
+
auth0Apollo: auth0ApolloGenerator({}),
|
|
50
|
+
auth0Components: auth0ComponentsGenerator({}),
|
|
51
|
+
auth0Callback: reactRoutesGenerator({
|
|
52
|
+
id: 'auth',
|
|
53
|
+
name: 'auth',
|
|
54
|
+
children: {
|
|
55
|
+
auth: auth0CallbackGenerator({}),
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
appCompiler.registerAppCompiler({
|
|
62
|
+
pluginId,
|
|
63
|
+
appType: adminAppEntryType,
|
|
64
|
+
compile: ({ appCompiler }) => {
|
|
65
|
+
appCompiler.addRootChildren({
|
|
66
|
+
auth: reactAuth0Generator({
|
|
67
|
+
callbackPath: 'auth/auth0-callback',
|
|
68
|
+
}),
|
|
69
|
+
authHooks: auth0HooksGenerator({}),
|
|
70
|
+
authIdentify: authIdentifyGenerator({}),
|
|
71
|
+
auth0Apollo: auth0ApolloGenerator({}),
|
|
72
|
+
auth0Components: auth0ComponentsGenerator({}),
|
|
73
|
+
auth0Callback: reactRoutesGenerator({
|
|
74
|
+
id: 'auth',
|
|
75
|
+
name: 'auth',
|
|
76
|
+
children: {
|
|
77
|
+
auth: auth0CallbackGenerator({}),
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
return {};
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/auth0/core/node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,eAAe,0BAA0B,CAAC;IACxC,YAAY,EAAE;QACZ,WAAW,EAAE,eAAe;KAC7B;IACD,OAAO,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@@
|
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../../src/auth0/core/schema/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,eAAO,MAAM,8BAA8B,EAAE,qBAAqB,EAejE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const AUTH0_PLUGIN_CONFIG_MIGRATIONS = [
|
|
2
|
+
{
|
|
3
|
+
name: 'move-models',
|
|
4
|
+
version: 1,
|
|
5
|
+
migrate: (config) => {
|
|
6
|
+
const typedConfig = config;
|
|
7
|
+
return {
|
|
8
|
+
...typedConfig,
|
|
9
|
+
userAccountModelRef: undefined,
|
|
10
|
+
modelRefs: {
|
|
11
|
+
user: typedConfig.userAccountModelRef,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../../../src/auth0/core/schema/migrations.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,8BAA8B,GAA4B;IACrE;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,MAAM,WAAW,GAAG,MAAyC,CAAC;YAC9D,OAAO;gBACL,GAAG,WAAW;gBACd,mBAAmB,EAAE,SAAS;gBAC9B,SAAS,EAAE;oBACT,IAAI,EAAE,WAAW,CAAC,mBAAmB;iBACtC;aACF,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModelMergerModelInput } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import type { Auth0PluginDefinition } from './plugin-definition.js';
|
|
3
|
+
export declare function createAuth0Models({ authFeatureRef, modelRefs, }: Pick<Auth0PluginDefinition, 'authFeatureRef' | 'modelRefs'>): {
|
|
4
|
+
user: ModelMergerModelInput;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/auth0/core/schema/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wBAAgB,iBAAiB,CAAC,EAChC,cAAc,EACd,SAAS,GACV,EAAE,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,WAAW,CAAC,GAAG;IAC/D,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CA+BA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function createAuth0Models({ authFeatureRef, modelRefs, }) {
|
|
2
|
+
return {
|
|
3
|
+
user: {
|
|
4
|
+
name: modelRefs.user,
|
|
5
|
+
featureRef: authFeatureRef,
|
|
6
|
+
model: {
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
name: 'id',
|
|
10
|
+
type: 'uuid',
|
|
11
|
+
options: { genUuid: true },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'email',
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'auth0Id',
|
|
19
|
+
type: 'string',
|
|
20
|
+
isOptional: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
primaryKeyFieldRefs: ['id'],
|
|
24
|
+
uniqueConstraints: [
|
|
25
|
+
{
|
|
26
|
+
fields: [{ fieldRef: 'auth0Id' }],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/auth0/core/schema/models.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,iBAAiB,CAAC,EAChC,cAAc,EACd,SAAS,GACmD;IAG5D,OAAO;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,UAAU,EAAE,cAAc;YAC1B,KAAK,EAAE;gBACL,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;qBAC3B;oBACD;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;qBACf;oBACD;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,IAAI;qBACjB;iBACF;gBACD,mBAAmB,EAAE,CAAC,IAAI,CAAC;gBAC3B,iBAAiB,EAAE;oBACjB;wBACE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;qBAClC;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|