@betterportal/auth-default 0.0.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.
Files changed (62) hide show
  1. package/README.md +12 -0
  2. package/bsb-plugin.json +23 -0
  3. package/bsb-tests.json +14 -0
  4. package/lib/defaultAuthManifest.d.ts +41 -0
  5. package/lib/defaultAuthManifest.d.ts.map +1 -0
  6. package/lib/defaultAuthManifest.js +67 -0
  7. package/lib/defaultAuthManifest.js.map +1 -0
  8. package/lib/index.d.ts +4 -0
  9. package/lib/index.d.ts.map +1 -0
  10. package/lib/index.js +4 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/plugins/service-betterportal-auth-default/.bp-generated/registry.d.ts +3 -0
  13. package/lib/plugins/service-betterportal-auth-default/.bp-generated/registry.d.ts.map +1 -0
  14. package/lib/plugins/service-betterportal-auth-default/.bp-generated/registry.js +122 -0
  15. package/lib/plugins/service-betterportal-auth-default/.bp-generated/registry.js.map +1 -0
  16. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.d.ts +5 -0
  17. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.d.ts.map +1 -0
  18. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.js +10 -0
  19. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.js.map +1 -0
  20. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.d.ts +4 -0
  21. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.d.ts.map +1 -0
  22. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.js +81 -0
  23. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.js.map +1 -0
  24. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/index.d.ts +89 -0
  25. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/index.d.ts.map +1 -0
  26. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/index.js +186 -0
  27. package/lib/plugins/service-betterportal-auth-default/bp-routes/login/index.js.map +1 -0
  28. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/_theme.bootstrap1/index.d.ts +5 -0
  29. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/_theme.bootstrap1/index.d.ts.map +1 -0
  30. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/_theme.bootstrap1/index.js +7 -0
  31. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/_theme.bootstrap1/index.js.map +1 -0
  32. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/index.d.ts +25 -0
  33. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/index.d.ts.map +1 -0
  34. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/index.js +38 -0
  35. package/lib/plugins/service-betterportal-auth-default/bp-routes/logout/index.js.map +1 -0
  36. package/lib/plugins/service-betterportal-auth-default/bp-routes/refresh/index.d.ts +31 -0
  37. package/lib/plugins/service-betterportal-auth-default/bp-routes/refresh/index.d.ts.map +1 -0
  38. package/lib/plugins/service-betterportal-auth-default/bp-routes/refresh/index.js +92 -0
  39. package/lib/plugins/service-betterportal-auth-default/bp-routes/refresh/index.js.map +1 -0
  40. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.400.d.ts +7 -0
  41. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.400.d.ts.map +1 -0
  42. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.400.js +7 -0
  43. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.400.js.map +1 -0
  44. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.d.ts +4 -0
  45. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.d.ts.map +1 -0
  46. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.js +63 -0
  47. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/_theme.bootstrap1/index.js.map +1 -0
  48. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/index.d.ts +64 -0
  49. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/index.d.ts.map +1 -0
  50. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/index.js +106 -0
  51. package/lib/plugins/service-betterportal-auth-default/bp-routes/register/index.js.map +1 -0
  52. package/lib/plugins/service-betterportal-auth-default/index.d.ts +115 -0
  53. package/lib/plugins/service-betterportal-auth-default/index.d.ts.map +1 -0
  54. package/lib/plugins/service-betterportal-auth-default/index.js +121 -0
  55. package/lib/plugins/service-betterportal-auth-default/index.js.map +1 -0
  56. package/lib/schemas/service-betterportal-auth-default.json +145 -0
  57. package/lib/schemas/service-betterportal-auth-default.plugin.json +158 -0
  58. package/lib/userStore.d.ts +52 -0
  59. package/lib/userStore.d.ts.map +1 -0
  60. package/lib/userStore.js +132 -0
  61. package/lib/userStore.js.map +1 -0
  62. package/package.json +68 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # BetterPortal Auth Plugin for Node.js
2
+
3
+ Default BetterPortal v10 auth plugin package.
4
+
5
+ This package defines the initial JWT-oriented auth contract for:
6
+
7
+ - runtime identity
8
+ - control-plane identity
9
+ - refresh flows
10
+ - user-management-adjacent APIs
11
+
12
+ It depends on the BetterPortal framework contracts and keeps auth as a plugin category rather than core behavior.
@@ -0,0 +1,23 @@
1
+ {
2
+ "nodejs": [
3
+ {
4
+ "id": "service-betterportal-auth-default",
5
+ "name": "service-betterportal-auth-default",
6
+ "basePath": "./",
7
+ "description": "Default BetterPortal v10 auth service: JWKS, login/logout/refresh, bcrypt user store",
8
+ "tags": [
9
+ "betterportal",
10
+ "auth",
11
+ "jwt",
12
+ "jwks"
13
+ ],
14
+ "documentation": [
15
+ "./README.md"
16
+ ],
17
+ "pluginPath": "src/plugins/service-betterportal-auth-default/",
18
+ "links": {
19
+ "github": "git+https://github.com/BetterCorp/BetterPortal.git"
20
+ }
21
+ }
22
+ ]
23
+ }
package/bsb-tests.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "nodejs": [
3
+ {
4
+ "id": "service-betterportal-auth-default",
5
+ "skip": true,
6
+ "default": {
7
+ "config": {},
8
+ "setup": null,
9
+ "dispose": null
10
+ },
11
+ "tests": []
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,41 @@
1
+ import * as av from "anyvali";
2
+ import type { Infer } from "anyvali";
3
+ import { AdminApiDescriptor, AuthAudienceRule, PluginManifest, ViewPermissionDefinition } from "@betterportal/framework";
4
+ export declare const RuntimeTokenConfigSchema: av.ObjectSchema<{
5
+ accessTokenSeconds: av.IntSchema;
6
+ refreshTokenSeconds: av.IntSchema;
7
+ runtimeAudiences: av.ArraySchema<av.StringSchema>;
8
+ controlPlaneAudiences: av.ArraySchema<av.StringSchema>;
9
+ }>;
10
+ export type RuntimeTokenConfig = Infer<typeof RuntimeTokenConfigSchema>;
11
+ export declare const DefaultRuntimeAudienceRules: readonly AuthAudienceRule[];
12
+ export declare const DefaultAuthPermissions: readonly ViewPermissionDefinition[];
13
+ export declare const DefaultAuthAdminApis: readonly AdminApiDescriptor[];
14
+ export declare const DefaultAuthManifest: PluginManifest;
15
+ export declare const RuntimeJwtClaimsContract: av.ObjectSchema<{
16
+ iss: av.StringSchema;
17
+ aud: av.UnionSchema<[av.StringSchema, av.ArraySchema<av.StringSchema>]>;
18
+ sub: av.StringSchema;
19
+ exp: av.IntSchema;
20
+ iat: av.IntSchema;
21
+ nbf: av.OptionalSchema<av.IntSchema>;
22
+ jti: av.StringSchema;
23
+ realm: av.EnumSchema<readonly ["runtime", "control-plane"]>;
24
+ tenantId: av.StringSchema;
25
+ appId: av.StringSchema;
26
+ roles: av.ArraySchema<av.StringSchema>;
27
+ tokenType: av.EnumSchema<readonly ["access", "refresh", "cp-envelope", "setup", "install"]>;
28
+ authProvider: av.OptionalSchema<av.StringSchema>;
29
+ providerSubject: av.OptionalSchema<av.StringSchema>;
30
+ provider: av.OptionalSchema<av.ObjectSchema<{
31
+ username: av.OptionalSchema<av.StringSchema>;
32
+ profileUrl: av.OptionalSchema<av.StringSchema>;
33
+ accountId: av.OptionalSchema<av.UnionSchema<[av.StringSchema, av.NumberSchema]>>;
34
+ nodeId: av.OptionalSchema<av.StringSchema>;
35
+ scope: av.OptionalSchema<av.StringSchema>;
36
+ }>>;
37
+ name: av.OptionalSchema<av.StringSchema>;
38
+ email: av.OptionalSchema<av.StringSchema>;
39
+ picture: av.OptionalSchema<av.StringSchema>;
40
+ }>;
41
+ //# sourceMappingURL=defaultAuthManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultAuthManifest.d.ts","sourceRoot":"","sources":["../src/defaultAuthManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAGhB,cAAc,EACd,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,wBAAwB;;;;;EAKT,CAAC;AAC7B,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,2BAA2B,EAAE,SAAS,gBAAgB,EASlE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,SAAS,wBAAwB,EAarE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAS7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,cAsBhC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;EAAkB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import * as av from "anyvali";
2
+ import { createPluginManifest, JwtClaimsSchema } from "@betterportal/framework";
3
+ export const RuntimeTokenConfigSchema = av.object({
4
+ accessTokenSeconds: av.int().min(1).default(60 * 15),
5
+ refreshTokenSeconds: av.int().min(1).default(60 * 60 * 24 * 7),
6
+ runtimeAudiences: av.array(av.string().minLength(1)).minItems(1),
7
+ controlPlaneAudiences: av.array(av.string().minLength(1)).minItems(1)
8
+ }, { unknownKeys: "strip" });
9
+ export const DefaultRuntimeAudienceRules = [
10
+ {
11
+ realm: "runtime",
12
+ audiences: ["betterportal-runtime"]
13
+ },
14
+ {
15
+ realm: "control-plane",
16
+ audiences: ["betterportal-control-plane"]
17
+ }
18
+ ];
19
+ export const DefaultAuthPermissions = [
20
+ {
21
+ id: "auth.user.read",
22
+ title: "Read authenticated user profile",
23
+ description: "Allows reading runtime user profile information.",
24
+ defaultRoles: ["user", "admin"]
25
+ },
26
+ {
27
+ id: "auth.user.manage",
28
+ title: "Manage users",
29
+ description: "Allows control-plane user administration.",
30
+ defaultRoles: ["admin"]
31
+ }
32
+ ];
33
+ export const DefaultAuthAdminApis = [
34
+ {
35
+ id: "auth-token-config",
36
+ title: "Auth token configuration",
37
+ description: "Manage auth token lifetimes and allowed audiences.",
38
+ path: "/admin/auth/token-config",
39
+ methods: ["GET", "PUT"],
40
+ supportsCustomUi: true
41
+ }
42
+ ];
43
+ export const DefaultAuthManifest = createPluginManifest({
44
+ pluginId: "auth.betterportal.default",
45
+ title: "BetterPortal Default Auth",
46
+ description: "JWT issuing auth plugin for BetterPortal v10 runtime and control-plane flows.",
47
+ version: "1.0.0",
48
+ category: "auth",
49
+ deploymentModes: ["bp-hosted", "customer-hosted", "self-hosted", "saas-managed"],
50
+ capabilities: [
51
+ "auth.jwt",
52
+ "auth.refresh-token",
53
+ "auth.runtime-identity",
54
+ "auth.control-plane-identity"
55
+ ],
56
+ supportedThemes: [],
57
+ supportedRenderModes: [],
58
+ views: [],
59
+ configSchemas: [],
60
+ permissions: [...DefaultAuthPermissions],
61
+ adminApis: [...DefaultAuthAdminApis],
62
+ cacheHints: {
63
+ metadataTtlSeconds: 1800
64
+ }
65
+ });
66
+ export const RuntimeJwtClaimsContract = JwtClaimsSchema;
67
+ //# sourceMappingURL=defaultAuthManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultAuthManifest.js","sourceRoot":"","sources":["../src/defaultAuthManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAGL,oBAAoB,EACpB,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC,MAAM,CAAC;IAChD,kBAAkB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IACpD,mBAAmB,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9D,gBAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChE,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;CACtE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AAG7B,MAAM,CAAC,MAAM,2BAA2B,GAAgC;IACtE;QACE,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,CAAC,sBAAsB,CAAC;KACpC;IACD;QACE,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,CAAC,4BAA4B,CAAC;KAC1C;CACF,CAAC;AAEF,MAAM,CAAC,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ultAuthManifest.js";
2
+ export * from "./userStore.js";
3
+ export * from "./plugins/service-betterportal-auth-default/index.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sDAAsD,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./defaultAuthManifest.js";
2
+ export * from "./userStore.js";
3
+ export * from "./plugins/service-betterportal-auth-default/index.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sDAAsD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BetterPortalRegistry } from "@betterportal/framework";
2
+ export declare const registry: BetterPortalRegistry;
3
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-default/.bp-generated/registry.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,QAAQ,EAAE,oBA8GtB,CAAC"}
@@ -0,0 +1,122 @@
1
+ // AUTO-GENERATED by BetterPortal codegen - DO NOT EDIT
2
+ import * as loginRoute from "../bp-routes/login/index.js";
3
+ import * as loginBootstrap1Page from "../bp-routes/login/_theme.bootstrap1/index.js";
4
+ import * as loginBootstrap1NavProfile from "../bp-routes/login/_theme.bootstrap1/_nav.profile.js";
5
+ import * as logoutRoute from "../bp-routes/logout/index.js";
6
+ import * as logoutBootstrap1Page from "../bp-routes/logout/_theme.bootstrap1/index.js";
7
+ import * as refreshRoute from "../bp-routes/refresh/index.js";
8
+ import * as registerRoute from "../bp-routes/register/index.js";
9
+ import * as registerBootstrap1PageS400 from "../bp-routes/register/_theme.bootstrap1/index.400.js";
10
+ import * as registerBootstrap1Page from "../bp-routes/register/_theme.bootstrap1/index.js";
11
+ export const registry = {
12
+ routes: [
13
+ {
14
+ viewId: "login.index",
15
+ path: "/login",
16
+ methods: ["GET", "POST"],
17
+ paramNames: [],
18
+ schemas: {
19
+ response: loginRoute.ResponseSchema,
20
+ query: loginRoute.QuerySchema,
21
+ headers: loginRoute.HeadersSchema,
22
+ request: loginRoute.RequestSchema
23
+ },
24
+ handlers: { GET: loginRoute.handleGet, POST: loginRoute.handlePost },
25
+ title: loginRoute.title,
26
+ description: loginRoute.description,
27
+ auth: loginRoute.auth,
28
+ role: loginRoute.role,
29
+ dependencies: loginRoute.dependencies,
30
+ chrome: loginRoute.chrome,
31
+ cacheHints: loginRoute.cacheHints,
32
+ demoScenarios: [],
33
+ themeRenderers: {
34
+ "bootstrap1": {
35
+ pages: [{ rendererId: "default", type: "page", render: loginBootstrap1Page.render }],
36
+ components: [],
37
+ fragments: [{ rendererId: "nav.profile", type: "fragment", fragmentLocation: "nav", fragmentId: "profile", render: loginBootstrap1NavProfile.render }]
38
+ }
39
+ }
40
+ },
41
+ {
42
+ viewId: "logout.index",
43
+ path: "/logout",
44
+ methods: ["POST", "GET"],
45
+ paramNames: [],
46
+ schemas: {
47
+ response: logoutRoute.ResponseSchema,
48
+ query: logoutRoute.QuerySchema,
49
+ headers: logoutRoute.HeadersSchema,
50
+ request: logoutRoute.RequestSchema
51
+ },
52
+ handlers: { POST: logoutRoute.handlePost, GET: logoutRoute.handleGet },
53
+ title: logoutRoute.title,
54
+ description: logoutRoute.description,
55
+ auth: logoutRoute.auth,
56
+ role: logoutRoute.role,
57
+ cacheHints: logoutRoute.cacheHints,
58
+ demoScenarios: [],
59
+ themeRenderers: {
60
+ "bootstrap1": {
61
+ pages: [{ rendererId: "default", type: "page", render: logoutBootstrap1Page.render }],
62
+ components: [],
63
+ fragments: []
64
+ }
65
+ }
66
+ },
67
+ {
68
+ viewId: "refresh.index",
69
+ path: "/refresh",
70
+ methods: ["POST"],
71
+ paramNames: [],
72
+ schemas: {
73
+ response: refreshRoute.ResponseSchema,
74
+ query: refreshRoute.QuerySchema,
75
+ headers: refreshRoute.HeadersSchema,
76
+ request: refreshRoute.RequestSchema
77
+ },
78
+ handlers: { POST: refreshRoute.handlePost },
79
+ title: refreshRoute.title,
80
+ description: refreshRoute.description,
81
+ auth: refreshRoute.auth,
82
+ role: refreshRoute.role,
83
+ cacheHints: refreshRoute.cacheHints,
84
+ demoScenarios: [],
85
+ themeRenderers: {}
86
+ },
87
+ {
88
+ viewId: "register.index",
89
+ path: "/register",
90
+ methods: ["GET", "POST"],
91
+ paramNames: [],
92
+ schemas: {
93
+ response: registerRoute.ResponseSchema,
94
+ query: registerRoute.QuerySchema,
95
+ headers: registerRoute.HeadersSchema,
96
+ request: registerRoute.RequestSchema
97
+ },
98
+ handlers: { GET: registerRoute.handleGet, POST: registerRoute.handlePost },
99
+ title: registerRoute.title,
100
+ description: registerRoute.description,
101
+ auth: registerRoute.auth,
102
+ role: registerRoute.role,
103
+ dependencies: registerRoute.dependencies,
104
+ chrome: registerRoute.chrome,
105
+ cacheHints: registerRoute.cacheHints,
106
+ demoScenarios: [],
107
+ themeRenderers: {
108
+ "bootstrap1": {
109
+ pages: [{ rendererId: "default", type: "page", render: registerBootstrap1Page.render }],
110
+ components: [],
111
+ fragments: []
112
+ }
113
+ },
114
+ statusRenderers: {
115
+ "bootstrap1": {
116
+ 400: { page: { rendererId: "default", type: "page", render: registerBootstrap1PageS400.render } }
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ };
122
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-default/.bp-generated/registry.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OA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AAM,EAAE,MAAM,EAAE,sBAAsB,CAAC,MAAM,EAAE,CAAC;oBACvF,UAAU,EAAE,EAAE;oBACd,SAAS,EAAE,EAAE;iBACd;aACF;YACD,eAAe,EAAE;gBACf,YAAY,EAAE;oBACZ,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,0BAA0B,CAAC,MAAM,EAAE,EAAE;iBAClG;aACF;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** @jsxImportSource jsx-htmx */
2
+ import type { HtmlRenderable } from "@betterportal/framework";
3
+ import type { ResponseData } from "../index.js";
4
+ export declare function render(data: ResponseData): HtmlRenderable;
5
+ //# sourceMappingURL=_nav.profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_nav.profile.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CA4BzD"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
2
+ export function render(data) {
3
+ if (!data.alreadyLoggedIn || !data.user) {
4
+ return (_jsx("a", { class: "btn btn-sm btn-primary", href: "/login", children: "Sign in" }));
5
+ }
6
+ const displayName = data.user.name || data.user.username || data.user.email || "Account";
7
+ const detail = data.user.email || data.user.username || displayName;
8
+ return (_jsxs("div", { class: "dropdown", children: [_jsx("button", { class: "btn btn-sm btn-light dropdown-toggle", type: "button", "data-bs-toggle": "dropdown", "aria-expanded": "false", children: displayName }), _jsxs("ul", { class: "dropdown-menu dropdown-menu-end", children: [_jsx("li", { children: _jsx("h6", { class: "dropdown-header", children: detail }) }), _jsx("li", { children: _jsx("hr", { class: "dropdown-divider" }) }), _jsx("li", { children: _jsx("a", { class: "dropdown-item", href: "/login?action=logout", children: "Logout" }) })] })] }));
9
+ }
10
+ //# sourceMappingURL=_nav.profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_nav.profile.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/_nav.profile.tsx"],"names":[],"mappings":";AAIA,MAAM,UAAU,MAAM,CAAC,IAAkB;IACvC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,CACL,YAAG,KAAK,EAAC,wBAAwB,EAAC,IAAI,EAAC,QAAQ,wBAE3C,CACL,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;IACzF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC;IAEpE,OAAO,CACL,eAAK,KAAK,EAAC,UAAU,aACnB,iBAAQ,KAAK,EAAC,sCAAsC,EAAC,IAAI,EAAC,QAAQ,oBAAgB,UAAU,mBAAe,OAAO,YAC/G,WAAW,GACL,EACT,cAAI,KAAK,EAAC,iCAAiC,aACzC,uBAAI,aAAI,KAAK,EAAC,iBAAiB,YAAE,MAAM,GAAM,GAAK,EAClD,uBAAI,aAAI,KAAK,EAAC,kBAAkB,GAAG,GAAK,EACxC,uBACI,YAAG,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,sBAAsB,uBAEhD,GACH,IACF,IACD,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { HtmlRenderable } from "@betterportal/framework";
2
+ import type { ResponseData } from "../index.js";
3
+ export declare function render(data: ResponseData): HtmlRenderable;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgDhD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAgHzD"}
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
2
+ /** @jsxImportSource jsx-htmx */
3
+ import { js } from "jsx-htmx";
4
+ function loginScript() {
5
+ // IIFE - htmx executes swapped <script> content as a plain script, where a
6
+ // top-level `return` inside a bare block is a SyntaxError.
7
+ return js(`(() => {
8
+ const form = document.getElementById("bp-login-form");
9
+ if (!form) return;
10
+ // Capture ?next= from URL into the hidden input so the server returns
11
+ // the correct HX-Location post-login.
12
+ const nextInput = form.querySelector('input[name="next"]');
13
+ if (nextInput) {
14
+ nextInput.value = new URLSearchParams(window.location.search).get("next") || "";
15
+ }
16
+ form.addEventListener("htmx:beforeRequest", () => {
17
+ const errEl = document.getElementById("bp-login-error");
18
+ if (errEl) errEl.classList.add("d-none");
19
+ });
20
+ form.addEventListener("htmx:responseError", (ev) => {
21
+ const xhr = ev.detail.xhr;
22
+ let body = null;
23
+ try { body = JSON.parse(xhr.responseText); } catch { /* non-JSON */ }
24
+ const errEl = document.getElementById("bp-login-error");
25
+ if (errEl) {
26
+ errEl.textContent = (body && body.message) || ("Login failed (HTTP " + xhr.status + ")");
27
+ errEl.classList.remove("d-none");
28
+ }
29
+ });
30
+ form.addEventListener("htmx:afterRequest", (ev) => {
31
+ const xhr = ev.detail.xhr;
32
+ let body = null;
33
+ try { body = JSON.parse(xhr.responseText); } catch { /* non-JSON */ }
34
+ const errEl = document.getElementById("bp-login-error");
35
+ if (!xhr.status || xhr.status >= 400 || !body || body.status !== "ok") {
36
+ if (errEl) {
37
+ errEl.textContent = (body && body.message) || ("Login failed (HTTP " + xhr.status + ")");
38
+ errEl.classList.remove("d-none");
39
+ }
40
+ return;
41
+ }
42
+ // Token storage happens via BP-SetHeader directives (shell shim) - writing
43
+ // bp.headers here too would stamp the wrong lock owner and block the
44
+ // server's later BP-RemoveHeader / refresh overwrites.
45
+ // Server sets HX-Location: next - htmx soft-navigates automatically. No reload.
46
+ });
47
+ })()`);
48
+ }
49
+ export function render(data) {
50
+ if (data.loggedOut) {
51
+ const next = data.nextUrl || "/";
52
+ return (_jsx("div", { class: "container py-5", style: "max-width: 420px;", children: _jsx("div", { class: "card border-0 shadow-sm", children: _jsxs("div", { class: "card-body text-center", children: [_jsx("h3", { class: "card-title mb-1", children: "Signed out" }), _jsx("p", { class: "text-secondary small mb-4", children: "You have been signed out." }), _jsx("a", { class: "btn btn-primary w-100", href: next, children: "Continue" })] }) }) }));
53
+ }
54
+ // Zero users -> this deployment still needs its first admin. Soft-redirect to
55
+ // the register view in-shell; URL bar follows via hx-push-url.
56
+ if (data.requiresFirstAdmin && data.firstAdminUrl) {
57
+ return (_jsx("div", { "hx-get": data.firstAdminUrl, "hx-trigger": "load", "hx-target": "#bp-main", "hx-swap": "innerHTML", "hx-push-url": "/register", children: _jsx("div", { class: "d-flex justify-content-center py-5", children: _jsx("div", { class: "spinner-border", role: "status", children: _jsx("span", { class: "visually-hidden", children: "Redirecting to first-admin setup..." }) }) }) }));
58
+ }
59
+ // Already signed in with an explicit destination - go there immediately,
60
+ // no interstitial. The shell maps the tenant path to its owning service.
61
+ if (data.alreadyLoggedIn && data.nextUrl) {
62
+ const next = data.nextUrl;
63
+ return (_jsxs("div", { class: "d-flex justify-content-center py-5", children: [_jsx("div", { class: "spinner-border", role: "status", children: _jsx("span", { class: "visually-hidden", children: "Redirecting..." }) }), _jsx("script", { children: js(`window.htmx.ajax("GET", ${JSON.stringify(next)}, { target: "#bp-main", swap: "innerHTML", push: ${JSON.stringify(next)} })`) })] }));
64
+ }
65
+ // Request already carried a valid token - show the signed-in state with a
66
+ // way out (logout path from app config) instead of a pointless login form.
67
+ if (data.alreadyLoggedIn) {
68
+ const displayName = data.user?.name || data.user?.username || data.user?.email || "your account";
69
+ return (_jsxs("div", { class: "container py-5", style: "max-width: 420px;", children: [_jsx("div", { class: "card border-0 shadow-sm", children: _jsxs("div", { class: "card-body text-center", children: [_jsx("h3", { class: "card-title mb-1", children: "Already signed in" }), _jsxs("p", { class: "text-secondary small mb-4", children: ["You are signed in as ", _jsx("strong", { children: displayName }), "."] }), _jsx("button", { id: "bp-login-continue", class: "btn btn-primary w-100 mb-2", children: "Continue" }), _jsx("button", { class: "btn btn-outline-secondary w-100", "hx-get": data.logoutUrl || "/login?action=logout", "hx-target": "#bp-main", "hx-swap": "innerHTML", "hx-push-url": "/login?action=logout", children: "Sign out" })] }) }), _jsx("script", { children: js(`(() => {
70
+ // Honour ?next= the same way the login form does, and soft-navigate
71
+ // inside the shell. The shell's config_request hook maps the tenant
72
+ // path to its owning service origin.
73
+ const next = new URLSearchParams(window.location.search).get("next") || "/";
74
+ document.getElementById("bp-login-continue")?.addEventListener("click", () => {
75
+ window.htmx.ajax("GET", next, { target: "#bp-main", swap: "innerHTML", push: next });
76
+ });
77
+ })()`) })] }));
78
+ }
79
+ return (_jsxs("div", { class: "container py-5", style: "max-width: 420px;", children: [_jsx("div", { class: "card border-0 shadow-sm", children: _jsxs("div", { class: "card-body", children: [_jsx("h3", { class: "card-title mb-1 text-center", children: "Sign in" }), _jsx("p", { class: "text-secondary text-center small mb-4", children: "BetterPortal admin" }), _jsxs("form", { id: "bp-login-form", "hx-post": "this", "hx-headers": '{"Accept":"application/json"}', "hx-swap": "none", onsubmit: "return window.bpLoginSubmit ? window.bpLoginSubmit(event) : false", "hx-on::response-error": "const xhr=event.detail.xhr;let body=null;try{body=JSON.parse(xhr.responseText)}catch(e){};const errEl=document.getElementById('bp-login-error');if(errEl){errEl.textContent=(body&&body.message)||('Login failed (HTTP '+xhr.status+')');errEl.classList.remove('d-none')}", children: [_jsxs("div", { class: "mb-3", children: [_jsx("label", { class: "form-label", children: "Username *" }), _jsx("input", { type: "text", class: "form-control", name: "username", autocomplete: "username", required: true, autofocus: true })] }), _jsxs("div", { class: "mb-3", children: [_jsx("label", { class: "form-label", children: "Password *" }), _jsx("input", { type: "password", class: "form-control", name: "password", autocomplete: "current-password", required: true })] }), _jsx("input", { type: "hidden", name: "next", value: "" }), _jsx("div", { class: "alert alert-danger d-none", id: "bp-login-error" }), _jsx("button", { type: "submit", class: "btn btn-primary w-100", children: "Sign in" })] })] }) }), _jsx("script", { children: loginScript() })] }));
80
+ }
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-default/bp-routes/login/_theme.bootstrap1/index.tsx"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAI9B,SAAS,WAAW;IAClB,2EAA2E;IAC3E,2DAA2D;IAC3D,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCL,CAAC,CAAC;AACT,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAkB;IACvC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;QACjC,OAAO,CACL,cAAK,KAAK,EAAC,gBAAgB,EAAC,KAAK,EAAC,mBAAmB,YACnD,cAAK,KAAK,EAAC,yBAAyB,YAClC,eAAK,KAAK,EAAC,uBAAuB,aAChC,aAAI,KAAK,EAAC,iBAAiB,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,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,EAAE,GAAG,EAC5C,cAAK,KAAK,EAAC,2BAA2B,EAAC,EAAE,EAAC,gBAAgB,GAAO,EACjE,iBAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,uBAAuB,wBAAiB,IAC/D,IACH,GACF,EACN,2BAAS,WAAW,EAAE,GAAU,IAC5B,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,89 @@
1
+ import * as av from "anyvali";
2
+ import type { Infer } from "anyvali";
3
+ import { type ApiAuthRequirement, type CacheHints, type BetterPortalRouteChrome } from "@betterportal/framework";
4
+ export declare const QuerySchema: av.ObjectSchema<{
5
+ action: av.OptionalSchema<av.StringSchema>;
6
+ next: av.OptionalSchema<av.StringSchema>;
7
+ }>;
8
+ export declare const HeadersSchema: av.ObjectSchema<{}>;
9
+ export declare const RequestSchema: av.ObjectSchema<{
10
+ username: av.StringSchema;
11
+ password: av.StringSchema;
12
+ next: av.OptionalSchema<av.StringSchema>;
13
+ }>;
14
+ export declare const ResponseSchema: av.ObjectSchema<{
15
+ status: av.EnumSchema<readonly ["ok", "error"]>;
16
+ message: av.OptionalSchema<av.StringSchema>;
17
+ accessToken: av.OptionalSchema<av.StringSchema>;
18
+ refreshToken: av.OptionalSchema<av.StringSchema>;
19
+ expiresInSeconds: av.OptionalSchema<av.IntSchema>;
20
+ user: av.OptionalSchema<av.ObjectSchema<{
21
+ id: av.StringSchema;
22
+ username: av.StringSchema;
23
+ email: av.OptionalSchema<av.StringSchema>;
24
+ name: av.OptionalSchema<av.StringSchema>;
25
+ }>>;
26
+ requiresFirstAdmin: av.OptionalSchema<av.BoolSchema>;
27
+ firstAdminUrl: av.OptionalSchema<av.StringSchema>;
28
+ alreadyLoggedIn: av.OptionalSchema<av.BoolSchema>;
29
+ loggedOut: av.OptionalSchema<av.BoolSchema>;
30
+ logoutUrl: av.OptionalSchema<av.StringSchema>;
31
+ nextUrl: av.OptionalSchema<av.StringSchema>;
32
+ }>;
33
+ export type ResponseData = Infer<typeof ResponseSchema>;
34
+ export declare const title = "Login";
35
+ export declare const description = "Authenticate with username and password to receive a JWT.";
36
+ export declare const role = "auth.login";
37
+ export declare const dependencies: string[];
38
+ export declare const chrome: BetterPortalRouteChrome;
39
+ export declare const auth: ApiAuthRequirement;
40
+ export declare const cacheHints: CacheHints;
41
+ export declare const handleGet: import("@betterportal/framework").RouteHandler<Record<string, string>, {
42
+ action?: string | undefined;
43
+ next?: string | undefined;
44
+ }, Record<string, string>, Record<string, unknown>, {
45
+ status: "ok" | "error";
46
+ message?: string | undefined;
47
+ accessToken?: string | undefined;
48
+ refreshToken?: string | undefined;
49
+ expiresInSeconds?: number | undefined;
50
+ user?: {
51
+ id: string;
52
+ username: string;
53
+ email?: string | undefined;
54
+ name?: string | undefined;
55
+ } | undefined;
56
+ requiresFirstAdmin?: boolean | undefined;
57
+ firstAdminUrl?: string | undefined;
58
+ alreadyLoggedIn?: boolean | undefined;
59
+ loggedOut?: boolean | undefined;
60
+ logoutUrl?: string | undefined;
61
+ nextUrl?: string | undefined;
62
+ }, unknown, Record<string, unknown>>;
63
+ export declare const handlePost: import("@betterportal/framework").RouteHandler<Record<string, string>, {
64
+ action?: string | undefined;
65
+ next?: string | undefined;
66
+ }, Record<string, string>, {
67
+ username: string;
68
+ password: string;
69
+ next?: string | undefined;
70
+ }, {
71
+ status: "ok" | "error";
72
+ message?: string | undefined;
73
+ accessToken?: string | undefined;
74
+ refreshToken?: string | undefined;
75
+ expiresInSeconds?: number | undefined;
76
+ user?: {
77
+ id: string;
78
+ username: string;
79
+ email?: string | undefined;
80
+ name?: string | undefined;
81
+ } | undefined;
82
+ requiresFirstAdmin?: boolean | undefined;
83
+ firstAdminUrl?: string | undefined;
84
+ alreadyLoggedIn?: boolean | undefined;
85
+ loggedOut?: boolean | undefined;
86
+ logoutUrl?: string | undefined;
87
+ nextUrl?: string | undefined;
88
+ }, unknown, Record<string, unknown>>;
89
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-default/bp-routes/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAIjC,eAAO,MAAM,WAAW;;;EAGI,CAAC;AAE7B,eAAO,MAAM,aAAa,qBAA0C,CAAC;AAErE,eAAO,MAAM,aAAa;;;;EAIE,CAAC;AAE7B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EA2BC,CAAC;AAC7B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,eAAO,MAAM,KAAK,UAAU,CAAC;AAC7B,eAAO,MAAM,WAAW,8DAA8D,CAAC;AACvF,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,eAAO,MAAM,YAAY,UAAsD,CAAC;AAChF,eAAO,MAAM,MAAM,EAAE,uBAA8C,CAAC;AAEpE,eAAO,MAAM,IAAI,EAAE,kBAGlB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAGxB,CAAC;AAeF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;oCAuDrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;oCA6EtB,CAAC"}