@betterportal/auth-authress-io 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.
- package/bsb-plugin.json +22 -0
- package/bsb-tests.json +14 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.d.ts +3 -0
- package/lib/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.js +82 -0
- package/lib/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.d.ts +5 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.js +51 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_nav.profile.d.ts +5 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_nav.profile.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_nav.profile.js +10 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_nav.profile.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.d.ts +5 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.js +206 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.d.ts +3 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.js +3 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/index.d.ts +92 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/index.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/index.js +187 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/index.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/logout/index.d.ts +27 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/logout/index.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/logout/index.js +35 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/logout/index.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/refresh/index.d.ts +29 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/refresh/index.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/refresh/index.js +87 -0
- package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/refresh/index.js.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/index.d.ts +146 -0
- package/lib/plugins/service-betterportal-auth-authress-io/index.d.ts.map +1 -0
- package/lib/plugins/service-betterportal-auth-authress-io/index.js +366 -0
- package/lib/plugins/service-betterportal-auth-authress-io/index.js.map +1 -0
- package/lib/schemas/service-betterportal-auth-authress-io.json +139 -0
- package/lib/schemas/service-betterportal-auth-authress-io.plugin.json +151 -0
- package/package.json +66 -0
package/bsb-plugin.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodejs": [
|
|
3
|
+
{
|
|
4
|
+
"id": "service-betterportal-auth-authress-io",
|
|
5
|
+
"name": "service.betterportal.auth.authress-io",
|
|
6
|
+
"basePath": "./",
|
|
7
|
+
"description": "BetterPortal Authress.io auth service",
|
|
8
|
+
"tags": [
|
|
9
|
+
"betterportal",
|
|
10
|
+
"auth",
|
|
11
|
+
"authress"
|
|
12
|
+
],
|
|
13
|
+
"documentation": [
|
|
14
|
+
"./README.md"
|
|
15
|
+
],
|
|
16
|
+
"pluginPath": "src/plugins/service-betterportal-auth-authress-io/",
|
|
17
|
+
"links": {
|
|
18
|
+
"github": "git+https://github.com/BetterCorp/BetterPortal.git"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
package/bsb-tests.json
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0DAA0D,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0DAA0D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,eAAO,MAAM,QAAQ,EAAE,oBAwEtB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 loginBootstrap1BackgroundMonitor from "../bp-routes/login/_theme.bootstrap1/_background.monitor.js";
|
|
5
|
+
import * as loginBootstrap1NavProfile from "../bp-routes/login/_theme.bootstrap1/_nav.profile.js";
|
|
6
|
+
import * as loginEmbeddedBackgroundMonitor from "../bp-routes/login/_theme.embedded/_background.monitor.js";
|
|
7
|
+
import * as logoutRoute from "../bp-routes/logout/index.js";
|
|
8
|
+
import * as refreshRoute from "../bp-routes/refresh/index.js";
|
|
9
|
+
export const registry = {
|
|
10
|
+
routes: [
|
|
11
|
+
{
|
|
12
|
+
viewId: "login.index",
|
|
13
|
+
path: "/login",
|
|
14
|
+
methods: ["GET", "POST"],
|
|
15
|
+
paramNames: [],
|
|
16
|
+
schemas: {
|
|
17
|
+
response: loginRoute.ResponseSchema,
|
|
18
|
+
query: loginRoute.QuerySchema,
|
|
19
|
+
headers: loginRoute.HeadersSchema,
|
|
20
|
+
request: loginRoute.RequestSchema
|
|
21
|
+
},
|
|
22
|
+
handlers: { GET: loginRoute.handleGet, POST: loginRoute.handlePost },
|
|
23
|
+
title: loginRoute.title,
|
|
24
|
+
description: loginRoute.description,
|
|
25
|
+
auth: loginRoute.auth,
|
|
26
|
+
role: loginRoute.role,
|
|
27
|
+
dependencies: loginRoute.dependencies,
|
|
28
|
+
chrome: loginRoute.chrome,
|
|
29
|
+
cacheHints: loginRoute.cacheHints,
|
|
30
|
+
demoScenarios: [],
|
|
31
|
+
themeRenderers: {
|
|
32
|
+
"bootstrap1": {
|
|
33
|
+
pages: [{ rendererId: "default", type: "page", render: loginBootstrap1Page.render }],
|
|
34
|
+
components: [],
|
|
35
|
+
fragments: [{ rendererId: "background.monitor", type: "fragment", fragmentLocation: "background", fragmentId: "monitor", render: loginBootstrap1BackgroundMonitor.render }, { rendererId: "nav.profile", type: "fragment", fragmentLocation: "nav", fragmentId: "profile", render: loginBootstrap1NavProfile.render }]
|
|
36
|
+
},
|
|
37
|
+
"embedded": {
|
|
38
|
+
pages: [],
|
|
39
|
+
components: [],
|
|
40
|
+
fragments: [{ rendererId: "background.monitor", type: "fragment", fragmentLocation: "background", fragmentId: "monitor", render: loginEmbeddedBackgroundMonitor.render }]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
viewId: "logout.index",
|
|
46
|
+
path: "/logout",
|
|
47
|
+
methods: ["GET"],
|
|
48
|
+
paramNames: [],
|
|
49
|
+
schemas: {
|
|
50
|
+
response: logoutRoute.ResponseSchema,
|
|
51
|
+
query: logoutRoute.QuerySchema
|
|
52
|
+
},
|
|
53
|
+
handlers: { GET: logoutRoute.handleGet },
|
|
54
|
+
title: logoutRoute.title,
|
|
55
|
+
description: logoutRoute.description,
|
|
56
|
+
auth: logoutRoute.auth,
|
|
57
|
+
role: logoutRoute.role,
|
|
58
|
+
cacheHints: logoutRoute.cacheHints,
|
|
59
|
+
demoScenarios: [],
|
|
60
|
+
themeRenderers: {}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
viewId: "refresh.index",
|
|
64
|
+
path: "/refresh",
|
|
65
|
+
methods: ["POST"],
|
|
66
|
+
paramNames: [],
|
|
67
|
+
schemas: {
|
|
68
|
+
response: refreshRoute.ResponseSchema,
|
|
69
|
+
request: refreshRoute.RequestSchema
|
|
70
|
+
},
|
|
71
|
+
handlers: { POST: refreshRoute.handlePost },
|
|
72
|
+
title: refreshRoute.title,
|
|
73
|
+
description: refreshRoute.description,
|
|
74
|
+
auth: refreshRoute.auth,
|
|
75
|
+
role: refreshRoute.role,
|
|
76
|
+
cacheHints: refreshRoute.cacheHints,
|
|
77
|
+
demoScenarios: [],
|
|
78
|
+
themeRenderers: {}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/plugins/service-betterportal-auth-authress-io/.bp-generated/registry.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,mBAAmB,MAAM,+CAA+C,CAAC;AACrF,OAAO,KAAK,gCAAgC,MAAM,6DAA6D,CAAC;AAChH,OAAO,KAAK,yBAAyB,MAAM,sDAAsD,CAAC;AAClG,OAAO,KAAK,8BAA8B,MAAM,2DAA2D,CAAC;AAC5G,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAG9D,MAAM,CAAC,MAAM,QAAQ,GAAyB;IAC5C,MAAM,EAAE;QACN;YACE,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC,KAAK,EAAC,MAAM,CAAC;YACvB,UAAU,EAAE,EAAE;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,UAAU,CAAC,cAAc;gBACnC,KAAK,EAAE,UAAU,CAAC,WAAW;gBAC7B,OAAO,EAAE,UAAU,CAAC,aAAa;gBACjC,OAAO,EAAE,UAAU,CAAC,aAAa;aAClC;YACD,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE;YACpE,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,YAAY,EAAE,UAAU,CAAC,YAAY;YACrC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,aAAa,EAAE,EAAE;YACjB,cAAc,EAAE;gBACd,YAAY,EAAE;oBACZ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;SACnB;QACD;YACE,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,UAAU,EAAE,EAAE;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,YAAY,CAAC,cAAc;gBACrC,OAAO,EAAE,YAAY,CAAC,aAAa;aACpC;YACD,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,EAAE;YAC3C,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,aAAa,EAAE,EAAE;YACjB,cAAc,EAAE,EAAE;SACnB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_background.monitor.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAwEzD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
|
|
2
|
+
import { js } from "jsx-htmx";
|
|
3
|
+
export function render(data) {
|
|
4
|
+
if (data.status === "error" || !data.authressApiUrl)
|
|
5
|
+
return _jsx("div", {});
|
|
6
|
+
return (_jsxs("div", { "data-bp-authress-background": "", "data-authress-api-url": data.authressApiUrl, "data-authress-application-id": data.authressApplicationId || "", children: [_jsx("script", { src: "https://cdn.jsdelivr.net/npm/@authress/login/dist/authress.min.js" }), _jsx("form", { "data-bp-authress-refresh-form": "", "hx-post": "/refresh", "hx-headers": '{"Accept":"application/json"}', "hx-swap": "none", children: _jsx("input", { type: "hidden", name: "accessToken", value: "" }) }), _jsx("script", { children: js(() => {
|
|
7
|
+
(() => {
|
|
8
|
+
const root = document.currentScript?.closest("[data-bp-authress-background]");
|
|
9
|
+
if (!root || root.dataset.monitorStarted === "1")
|
|
10
|
+
return;
|
|
11
|
+
root.dataset.monitorStarted = "1";
|
|
12
|
+
const browserWindow = window;
|
|
13
|
+
const waitForAuthress = async () => {
|
|
14
|
+
while (browserWindow.Authress === undefined && browserWindow.authress === undefined) {
|
|
15
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16
|
+
}
|
|
17
|
+
return browserWindow.Authress || browserWindow.authress;
|
|
18
|
+
};
|
|
19
|
+
const form = root.querySelector("[data-bp-authress-refresh-form]");
|
|
20
|
+
if (form && browserWindow.htmx)
|
|
21
|
+
browserWindow.htmx.process(form);
|
|
22
|
+
let lastToken = "";
|
|
23
|
+
const refreshBpToken = async () => {
|
|
24
|
+
const sdk = await waitForAuthress();
|
|
25
|
+
if (!sdk)
|
|
26
|
+
return;
|
|
27
|
+
const settings = { authressApiUrl: root.dataset.authressApiUrl };
|
|
28
|
+
if (root.dataset.authressApplicationId)
|
|
29
|
+
settings.applicationId = root.dataset.authressApplicationId;
|
|
30
|
+
const loginClient = new sdk.LoginClient(settings);
|
|
31
|
+
if (!(await loginClient.userSessionExists()))
|
|
32
|
+
return;
|
|
33
|
+
const accessToken = await loginClient.ensureToken();
|
|
34
|
+
if (!accessToken || accessToken === lastToken)
|
|
35
|
+
return;
|
|
36
|
+
lastToken = accessToken;
|
|
37
|
+
const input = form?.querySelector('input[name="accessToken"]');
|
|
38
|
+
if (input)
|
|
39
|
+
input.value = accessToken;
|
|
40
|
+
form?.requestSubmit();
|
|
41
|
+
};
|
|
42
|
+
void refreshBpToken();
|
|
43
|
+
window.setInterval(() => { void refreshBpToken(); }, 60_000);
|
|
44
|
+
document.addEventListener("visibilitychange", () => {
|
|
45
|
+
if (!document.hidden)
|
|
46
|
+
void refreshBpToken();
|
|
47
|
+
});
|
|
48
|
+
})();
|
|
49
|
+
}) })] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=_background.monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_background.monitor.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/_background.monitor.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,MAAM,UAAU,MAAM,CAAC,IAAkB;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc;QAAE,OAAO,eAAW,CAAC;IAExE,OAAO,CACL,8CAC8B,EAAE,2BACP,IAAI,CAAC,cAAc,kCACZ,IAAI,CAAC,qBAAqB,IAAI,EAAE,aAE9D,iBAAQ,GAAG,EAAC,mEAAmE,GAAU,EACzF,gDAAoC,EAAE,aAAS,UAAU,gBAAY,+BAA+B,aAAS,MAAM,YACjH,gBAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,aAAa,EAAC,KAAK,EAAC,EAAE,GAAG,GAC9C,EACP,2BACG,EAAE,CAAC,GAAG,EAAE;oBACP,CAAC,GAAG,EAAE;wBACJ,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,+BAA+B,CAAuB,CAAC;wBACpG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,GAAG;4BAAE,OAAO;wBACzD,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,GAAG,CAAC;wBAElC,MAAM,aAAa,GAAG,MAcrB,CAAC;wBAEF,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE;4BACjC,OAAO,aAAa,CAAC,QAAQ,KAA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KAAK,GAAG,WAAW,CAAC;4BACrC,IAAI,EAAE,aAAa,EAAE,CAAC;wBACxB,CAAC,CAAC;wBAEF,KAAK,cAAc,EAAE,CAAC;wBACtB,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;wBAC7D,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;4BACjD,IAAI,CAAC,QAAQ,CAAC,MAAM;gCAAE,KAAK,cAAc,EAAE,CAAC;wBAC9C,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC,EAAE,CAAC;gBACP,CAAC,CAAC,GACK,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_nav.profile.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/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.email || data.user.id || "Account";
|
|
7
|
+
const detail = data.user.email || data.user.id || 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-authress-io/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,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;IACnF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,WAAW,CAAC;IAE9D,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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAqQzD"}
|
package/lib/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "jsx-htmx/jsx-runtime";
|
|
2
|
+
import { js } from "jsx-htmx";
|
|
3
|
+
export function render(data) {
|
|
4
|
+
if (data.loggedOut) {
|
|
5
|
+
const next = data.nextUrl || "/";
|
|
6
|
+
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" })] }) }) }));
|
|
7
|
+
}
|
|
8
|
+
const nextUrl = data.nextUrl || "/";
|
|
9
|
+
const scopes = JSON.stringify(data.scopes?.length ? data.scopes : ["openid", "profile", "email"]);
|
|
10
|
+
return (_jsxs("main", { id: "bp-authress-page", class: "bp-authress-shell", "data-authress-api-url": data.authressApiUrl || "", "data-authress-application-id": data.authressApplicationId || "", "data-next-url": nextUrl, "data-scopes": scopes, "data-mode": data.alreadyLoggedIn ? "signed-in" : data.status === "error" ? "error" : "login", children: [_jsx("script", { src: "https://cdn.jsdelivr.net/npm/@authress/login/dist/authress.min.js" }), _jsxs("form", { id: "bp-authress-token-form", "hx-post": "/login", "hx-headers": '{"Accept":"application/json"}', style: "display:none", children: [_jsx("input", { type: "hidden", name: "accessToken", value: "" }), _jsx("input", { type: "hidden", name: "next", value: nextUrl }), _jsx("input", { type: "hidden", name: "userId", value: "" }), _jsx("input", { type: "hidden", name: "name", value: "" }), _jsx("input", { type: "hidden", name: "email", value: "" }), _jsx("input", { type: "hidden", name: "picture", value: "" })] }), _jsxs("section", { class: "bp-authress-panel", children: [_jsx("div", { class: "bp-authress-mark", "aria-hidden": "true", children: "A" }), _jsx("h1", { children: "Sign in" }), _jsx("p", { class: "bp-authress-copy", children: "Continue with your Authress account." }), _jsxs("div", { class: "bp-authress-status-row", role: "status", "aria-live": "polite", children: [_jsx("span", { class: "bp-authress-spinner", "aria-hidden": "true" }), _jsx("span", { id: "bp-authress-status", children: data.message || "Preparing sign in." })] })] }), _jsx("script", { children: js(() => {
|
|
11
|
+
const page = document.getElementById("bp-authress-page");
|
|
12
|
+
const form = document.getElementById("bp-authress-token-form");
|
|
13
|
+
const status = document.getElementById("bp-authress-status");
|
|
14
|
+
const browserWindow = window;
|
|
15
|
+
const setStatus = (message) => {
|
|
16
|
+
if (status)
|
|
17
|
+
status.textContent = message;
|
|
18
|
+
page?.classList.toggle("is-error", /failed|missing|could not|did not|requires/i.test(message || ""));
|
|
19
|
+
};
|
|
20
|
+
const softNavigate = (target) => {
|
|
21
|
+
if (browserWindow.htmx && target && !target.startsWith("http://") && !target.startsWith("https://")) {
|
|
22
|
+
browserWindow.htmx.ajax("GET", target, { target: "#bp-main", swap: "innerHTML", push: target });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
window.location.assign(target || "/");
|
|
26
|
+
};
|
|
27
|
+
const waitForAuthress = async () => {
|
|
28
|
+
while (browserWindow.Authress === undefined && browserWindow.authress === undefined) {
|
|
29
|
+
await new Promise((resolve) => setTimeout(resolve, 80));
|
|
30
|
+
}
|
|
31
|
+
const authressClient = browserWindow.Authress || browserWindow.authress;
|
|
32
|
+
if (!authressClient)
|
|
33
|
+
throw new Error("Authress SDK did not load");
|
|
34
|
+
return authressClient;
|
|
35
|
+
};
|
|
36
|
+
form?.addEventListener("htmx:afterRequest", (event) => {
|
|
37
|
+
const xhr = event.detail.xhr;
|
|
38
|
+
let body = null;
|
|
39
|
+
try {
|
|
40
|
+
body = JSON.parse(xhr.responseText);
|
|
41
|
+
}
|
|
42
|
+
catch { /* ignore */ }
|
|
43
|
+
if (xhr.status >= 400 || body?.status === "error") {
|
|
44
|
+
setStatus(body?.message || `Sign in failed (HTTP ${xhr.status})`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
softNavigate(body?.nextUrl || page?.dataset.nextUrl || "/");
|
|
48
|
+
});
|
|
49
|
+
(async () => {
|
|
50
|
+
if (!page)
|
|
51
|
+
return;
|
|
52
|
+
const target = page.dataset.nextUrl || "/";
|
|
53
|
+
if (page.dataset.mode === "signed-in") {
|
|
54
|
+
softNavigate(target);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (page.dataset.mode === "error") {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setStatus("Checking Authress session");
|
|
61
|
+
const authress = await waitForAuthress();
|
|
62
|
+
const settings = { authressApiUrl: page.dataset.authressApiUrl };
|
|
63
|
+
if (page.dataset.authressApplicationId) {
|
|
64
|
+
settings.applicationId = page.dataset.authressApplicationId;
|
|
65
|
+
}
|
|
66
|
+
const loginClient = new authress.LoginClient(settings);
|
|
67
|
+
const scopes = JSON.parse(page.dataset.scopes || "[]");
|
|
68
|
+
if (!(await loginClient.userSessionExists())) {
|
|
69
|
+
setStatus("Opening sign in");
|
|
70
|
+
await loginClient.authenticate({
|
|
71
|
+
redirectUrl: `${window.location.origin}${window.location.pathname}?next=${encodeURIComponent(target)}`,
|
|
72
|
+
scopes
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setStatus("Storing session");
|
|
77
|
+
const accessToken = await loginClient.ensureToken();
|
|
78
|
+
if (!accessToken) {
|
|
79
|
+
setStatus("Authress did not return an access token");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const tokenInput = form?.querySelector('input[name="accessToken"]');
|
|
83
|
+
const nextInput = form?.querySelector('input[name="next"]');
|
|
84
|
+
const readProfile = async () => {
|
|
85
|
+
const identity = loginClient.getUserIdentity
|
|
86
|
+
? await Promise.resolve(loginClient.getUserIdentity()).catch(() => null)
|
|
87
|
+
: null;
|
|
88
|
+
return identity && typeof identity === "object" ? identity : {};
|
|
89
|
+
};
|
|
90
|
+
const profile = await readProfile();
|
|
91
|
+
const profileString = (...keys) => {
|
|
92
|
+
for (const key of keys) {
|
|
93
|
+
const value = key.split(".").reduce((current, segment) => {
|
|
94
|
+
return current && typeof current === "object" ? current[segment] : undefined;
|
|
95
|
+
}, profile);
|
|
96
|
+
if (typeof value === "string" && value.trim())
|
|
97
|
+
return value.trim();
|
|
98
|
+
}
|
|
99
|
+
return "";
|
|
100
|
+
};
|
|
101
|
+
const fullName = [
|
|
102
|
+
profileString("given_name", "givenName"),
|
|
103
|
+
profileString("family_name", "familyName")
|
|
104
|
+
].filter(Boolean).join(" ");
|
|
105
|
+
const profileFields = {
|
|
106
|
+
userId: profileString("userId", "sub", "id", "data.id"),
|
|
107
|
+
name: profileString("name", "displayName", "preferred_username", "nickname", "data.name", "data.login") || fullName,
|
|
108
|
+
email: profileString("email", "email_address"),
|
|
109
|
+
picture: profileString("picture", "avatar", "avatarUrl", "data.avatar_url")
|
|
110
|
+
};
|
|
111
|
+
if (tokenInput)
|
|
112
|
+
tokenInput.value = accessToken;
|
|
113
|
+
if (nextInput)
|
|
114
|
+
nextInput.value = target;
|
|
115
|
+
for (const [key, value] of Object.entries(profileFields)) {
|
|
116
|
+
const input = form?.querySelector(`input[name="${key}"]`);
|
|
117
|
+
if (input && value)
|
|
118
|
+
input.value = value;
|
|
119
|
+
}
|
|
120
|
+
form?.setAttribute("hx-post", `${window.location.pathname}${window.location.search}`);
|
|
121
|
+
form?.requestSubmit();
|
|
122
|
+
})().catch((error) => {
|
|
123
|
+
setStatus(error?.message || "Sign in could not start.");
|
|
124
|
+
});
|
|
125
|
+
}) }), _jsx("style", { children: `
|
|
126
|
+
.bp-authress-shell {
|
|
127
|
+
min-height: 100vh;
|
|
128
|
+
width: 100%;
|
|
129
|
+
display: grid;
|
|
130
|
+
place-items: center;
|
|
131
|
+
padding: 24px;
|
|
132
|
+
background:
|
|
133
|
+
radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 34%),
|
|
134
|
+
linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
|
|
135
|
+
color: #111827;
|
|
136
|
+
}
|
|
137
|
+
.bp-authress-panel {
|
|
138
|
+
width: min(440px, 100%);
|
|
139
|
+
border: 1px solid rgba(15, 23, 42, 0.1);
|
|
140
|
+
border-radius: 8px;
|
|
141
|
+
background: rgba(255, 255, 255, 0.94);
|
|
142
|
+
padding: 32px;
|
|
143
|
+
box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
|
|
144
|
+
}
|
|
145
|
+
.bp-authress-mark {
|
|
146
|
+
width: 44px;
|
|
147
|
+
height: 44px;
|
|
148
|
+
display: grid;
|
|
149
|
+
place-items: center;
|
|
150
|
+
border-radius: 8px;
|
|
151
|
+
background: #2563eb;
|
|
152
|
+
color: #fff;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
margin-bottom: 18px;
|
|
155
|
+
}
|
|
156
|
+
.bp-authress-panel h1 {
|
|
157
|
+
margin: 0 0 6px;
|
|
158
|
+
font-size: 26px;
|
|
159
|
+
line-height: 1.2;
|
|
160
|
+
font-weight: 700;
|
|
161
|
+
}
|
|
162
|
+
.bp-authress-copy {
|
|
163
|
+
margin: 0 0 24px;
|
|
164
|
+
color: #64748b;
|
|
165
|
+
font-size: 14px;
|
|
166
|
+
}
|
|
167
|
+
.bp-authress-status-row {
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
gap: 12px;
|
|
171
|
+
border: 1px solid rgba(37, 99, 235, 0.18);
|
|
172
|
+
border-radius: 8px;
|
|
173
|
+
background: rgba(37, 99, 235, 0.06);
|
|
174
|
+
padding: 14px 16px;
|
|
175
|
+
}
|
|
176
|
+
.bp-authress-spinner {
|
|
177
|
+
width: 18px;
|
|
178
|
+
height: 18px;
|
|
179
|
+
flex: 0 0 18px;
|
|
180
|
+
border-radius: 999px;
|
|
181
|
+
border: 2px solid rgba(37, 99, 235, 0.22);
|
|
182
|
+
border-top-color: #2563eb;
|
|
183
|
+
animation: bp-authress-spin 0.8s linear infinite;
|
|
184
|
+
}
|
|
185
|
+
#bp-authress-status {
|
|
186
|
+
margin: 0;
|
|
187
|
+
color: #1e3a8a;
|
|
188
|
+
font-size: 14px;
|
|
189
|
+
line-height: 1.4;
|
|
190
|
+
}
|
|
191
|
+
.bp-authress-shell.is-error .bp-authress-status-row {
|
|
192
|
+
border-color: rgba(220, 38, 38, 0.24);
|
|
193
|
+
background: rgba(220, 38, 38, 0.07);
|
|
194
|
+
}
|
|
195
|
+
.bp-authress-shell.is-error .bp-authress-spinner {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
.bp-authress-shell.is-error #bp-authress-status {
|
|
199
|
+
color: #991b1b;
|
|
200
|
+
}
|
|
201
|
+
@keyframes bp-authress-spin {
|
|
202
|
+
to { transform: rotate(360deg); }
|
|
203
|
+
}
|
|
204
|
+
` })] }));
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.bootstrap1/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,MAAM,UAAU,MAAM,CAAC,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,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;4BACzD,MAAM,KAAK,GAAG,IAAI,EAAE,aAAa,CAAmB,eAAe,GAAG,IAAI,CAAC,CAAC;4BAC5E,IAAI,KAAK,IAAI,KAAK;gCAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;wBAC1C,CAAC;wBACD,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;wBACtF,IAAI,EAAE,aAAa,EAAE,CAAC;oBACxB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBACnB,SAAS,CAAC,KAAK,EAAE,OAAO,IAAI,0BAA0B,CAAC,CAAC;oBAC1D,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,GACK,EACT,0BACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA+EA,GACK,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_background.monitor.d.ts","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_background.monitor.js","sourceRoot":"","sources":["../../../../../../src/plugins/service-betterportal-auth-authress-io/bp-routes/login/_theme.embedded/_background.monitor.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
redirect: av.OptionalSchema<av.StringSchema>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const HeadersSchema: av.ObjectSchema<{}>;
|
|
10
|
+
export declare const RequestSchema: av.ObjectSchema<{
|
|
11
|
+
accessToken: av.StringSchema;
|
|
12
|
+
next: av.OptionalSchema<av.StringSchema>;
|
|
13
|
+
userId: av.OptionalSchema<av.StringSchema>;
|
|
14
|
+
name: av.OptionalSchema<av.StringSchema>;
|
|
15
|
+
email: av.OptionalSchema<av.StringSchema>;
|
|
16
|
+
picture: av.OptionalSchema<av.StringSchema>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const ResponseSchema: av.ObjectSchema<{
|
|
19
|
+
status: av.EnumSchema<readonly ["ok", "error"]>;
|
|
20
|
+
message: av.OptionalSchema<av.StringSchema>;
|
|
21
|
+
authressApiUrl: av.OptionalSchema<av.StringSchema>;
|
|
22
|
+
authressApplicationId: av.OptionalSchema<av.StringSchema>;
|
|
23
|
+
scopes: av.ArraySchema<av.StringSchema>;
|
|
24
|
+
alreadyLoggedIn: av.OptionalSchema<av.BoolSchema>;
|
|
25
|
+
loggedOut: av.OptionalSchema<av.BoolSchema>;
|
|
26
|
+
nextUrl: av.OptionalSchema<av.StringSchema>;
|
|
27
|
+
expiresInSeconds: av.OptionalSchema<av.IntSchema>;
|
|
28
|
+
user: av.OptionalSchema<av.ObjectSchema<{
|
|
29
|
+
id: av.OptionalSchema<av.StringSchema>;
|
|
30
|
+
name: av.OptionalSchema<av.StringSchema>;
|
|
31
|
+
email: av.OptionalSchema<av.StringSchema>;
|
|
32
|
+
picture: av.OptionalSchema<av.StringSchema>;
|
|
33
|
+
}>>;
|
|
34
|
+
}>;
|
|
35
|
+
export type ResponseData = Infer<typeof ResponseSchema>;
|
|
36
|
+
export declare const title = "Authress Login";
|
|
37
|
+
export declare const description = "Authenticate with Authress and store the Authress bearer token.";
|
|
38
|
+
export declare const role = "auth.login";
|
|
39
|
+
export declare const dependencies: string[];
|
|
40
|
+
export declare const chrome: BetterPortalRouteChrome;
|
|
41
|
+
export declare const auth: ApiAuthRequirement;
|
|
42
|
+
export declare const cacheHints: CacheHints;
|
|
43
|
+
export declare const handleGet: import("@betterportal/framework").RouteHandler<Record<string, string>, {
|
|
44
|
+
action?: string | undefined;
|
|
45
|
+
next?: string | undefined;
|
|
46
|
+
redirect?: string | undefined;
|
|
47
|
+
}, {}, Record<string, unknown>, {
|
|
48
|
+
status: "ok" | "error";
|
|
49
|
+
scopes: string[];
|
|
50
|
+
message?: string | undefined;
|
|
51
|
+
authressApiUrl?: string | undefined;
|
|
52
|
+
authressApplicationId?: string | undefined;
|
|
53
|
+
alreadyLoggedIn?: boolean | undefined;
|
|
54
|
+
loggedOut?: boolean | undefined;
|
|
55
|
+
nextUrl?: string | undefined;
|
|
56
|
+
expiresInSeconds?: number | undefined;
|
|
57
|
+
user?: {
|
|
58
|
+
id?: string | undefined;
|
|
59
|
+
name?: string | undefined;
|
|
60
|
+
email?: string | undefined;
|
|
61
|
+
picture?: string | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}, unknown, Record<string, unknown>>;
|
|
64
|
+
export declare const handlePost: import("@betterportal/framework").RouteHandler<Record<string, string>, {
|
|
65
|
+
action?: string | undefined;
|
|
66
|
+
next?: string | undefined;
|
|
67
|
+
redirect?: string | undefined;
|
|
68
|
+
}, Record<string, string>, {
|
|
69
|
+
accessToken: string;
|
|
70
|
+
next?: string | undefined;
|
|
71
|
+
userId?: string | undefined;
|
|
72
|
+
name?: string | undefined;
|
|
73
|
+
email?: string | undefined;
|
|
74
|
+
picture?: string | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
status: "ok" | "error";
|
|
77
|
+
scopes: string[];
|
|
78
|
+
message?: string | undefined;
|
|
79
|
+
authressApiUrl?: string | undefined;
|
|
80
|
+
authressApplicationId?: string | undefined;
|
|
81
|
+
alreadyLoggedIn?: boolean | undefined;
|
|
82
|
+
loggedOut?: boolean | undefined;
|
|
83
|
+
nextUrl?: string | undefined;
|
|
84
|
+
expiresInSeconds?: number | undefined;
|
|
85
|
+
user?: {
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
name?: string | undefined;
|
|
88
|
+
email?: string | undefined;
|
|
89
|
+
picture?: string | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
}, unknown, Record<string, unknown>>;
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/service-betterportal-auth-authress-io/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;AAKjC,eAAO,MAAM,WAAW;;;;EAII,CAAC;AAE7B,eAAO,MAAM,aAAa,qBAA0C,CAAC;AAErE,eAAO,MAAM,aAAa;;;;;;;EAOE,CAAC;AAE7B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;EAgBC,CAAC;AAC7B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,eAAO,MAAM,KAAK,mBAAmB,CAAC;AACtC,eAAO,MAAM,WAAW,oEAAoE,CAAC;AAC7F,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,eAAO,MAAM,YAAY,UAAoC,CAAC;AAC9D,eAAO,MAAM,MAAM,EAAE,uBAA8C,CAAC;AACpE,eAAO,MAAM,IAAI,EAAE,kBAAyD,CAAC;AAC7E,eAAO,MAAM,UAAU,EAAE,UAA0C,CAAC;AAsCpE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;oCAqDrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA8DtB,CAAC"}
|