@simulacrum/auth0-simulator 0.9.0 → 0.10.0
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/README.md +28 -206
- package/bin/start.js +7 -0
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js +2 -5
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/date.js +3 -9
- package/dist/auth/date.js.map +1 -1
- package/dist/auth/jwt.d.ts +1 -1
- package/dist/auth/jwt.d.ts.map +1 -1
- package/dist/auth/jwt.js +6 -11
- package/dist/auth/jwt.js.map +1 -1
- package/dist/auth/refresh-token.d.ts +2 -2
- package/dist/auth/refresh-token.d.ts.map +1 -1
- package/dist/auth/refresh-token.js +10 -15
- package/dist/auth/refresh-token.js.map +1 -1
- package/dist/config/get-config.d.ts +6 -6
- package/dist/config/get-config.d.ts.map +1 -1
- package/dist/config/get-config.js +18 -18
- package/dist/config/get-config.js.map +1 -1
- package/dist/handlers/auth0-handlers.d.ts +6 -10
- package/dist/handlers/auth0-handlers.d.ts.map +1 -1
- package/dist/handlers/auth0-handlers.js +81 -66
- package/dist/handlers/auth0-handlers.js.map +1 -1
- package/dist/handlers/index.d.ts +5 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +36 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/login-redirect.d.ts +2 -2
- package/dist/handlers/login-redirect.d.ts.map +1 -1
- package/dist/handlers/login-redirect.js +3 -7
- package/dist/handlers/login-redirect.js.map +1 -1
- package/dist/handlers/oauth-handlers.d.ts +10 -9
- package/dist/handlers/oauth-handlers.d.ts.map +1 -1
- package/dist/handlers/oauth-handlers.js +55 -58
- package/dist/handlers/oauth-handlers.js.map +1 -1
- package/dist/handlers/openid-handlers.d.ts +4 -4
- package/dist/handlers/openid-handlers.d.ts.map +1 -1
- package/dist/handlers/openid-handlers.js +11 -15
- package/dist/handlers/openid-handlers.js.map +1 -1
- package/dist/handlers/url.d.ts.map +1 -1
- package/dist/handlers/url.js +1 -5
- package/dist/handlers/url.js.map +1 -1
- package/dist/handlers/utils.d.ts +11 -4
- package/dist/handlers/utils.d.ts.map +1 -1
- package/dist/handlers/utils.js +11 -15
- package/dist/handlers/utils.js.map +1 -1
- package/dist/handlers/web-message.d.ts +1 -1
- package/dist/handlers/web-message.d.ts.map +1 -1
- package/dist/handlers/web-message.js +8 -12
- package/dist/handlers/web-message.js.map +1 -1
- package/dist/index.d.ts +16 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -127
- package/dist/index.js.map +1 -1
- package/dist/middleware/create-cors.d.ts +1 -1
- package/dist/middleware/create-cors.js +2 -9
- package/dist/middleware/create-cors.js.map +1 -1
- package/dist/middleware/error-handling.d.ts +3 -0
- package/dist/middleware/error-handling.d.ts.map +1 -0
- package/dist/{error-handling-middleware.js → middleware/error-handling.js} +5 -11
- package/dist/middleware/error-handling.js.map +1 -0
- package/dist/middleware/no-cache.d.ts +1 -1
- package/dist/middleware/no-cache.js +1 -5
- package/dist/middleware/no-cache.js.map +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.js +3 -10
- package/dist/middleware/session.js.map +1 -1
- package/dist/rules/extensionless-file-name.js +1 -5
- package/dist/rules/extensionless-file-name.js.map +1 -1
- package/dist/rules/parse-rules-files.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.js +15 -22
- package/dist/rules/parse-rules-files.js.map +1 -1
- package/dist/rules/rules-runner.d.ts +2 -2
- package/dist/rules/rules-runner.d.ts.map +1 -1
- package/dist/rules/rules-runner.js +14 -21
- package/dist/rules/rules-runner.js.map +1 -1
- package/dist/rules/types.d.ts +1 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +1 -2
- package/dist/store/entities.d.ts +111 -0
- package/dist/store/entities.d.ts.map +1 -0
- package/dist/store/entities.js +38 -0
- package/dist/store/entities.js.map +1 -0
- package/dist/store/index.d.ts +37 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +44 -0
- package/dist/store/index.js.map +1 -0
- package/dist/types.d.ts +20 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -25
- package/dist/types.js.map +1 -1
- package/dist/views/login.d.ts +2 -2
- package/dist/views/login.d.ts.map +1 -1
- package/dist/views/login.js +81 -34
- package/dist/views/login.js.map +1 -1
- package/dist/views/username-password.d.ts +2 -2
- package/dist/views/username-password.d.ts.map +1 -1
- package/dist/views/username-password.js +3 -7
- package/dist/views/username-password.js.map +1 -1
- package/dist/views/web-message.d.ts +1 -1
- package/dist/views/web-message.d.ts.map +1 -1
- package/dist/views/web-message.js +3 -10
- package/dist/views/web-message.js.map +1 -1
- package/package.json +24 -41
- package/CHANGELOG.md +0 -176
- package/bin/index.js +0 -2
- package/dist/error-handling-middleware.d.ts +0 -3
- package/dist/error-handling-middleware.d.ts.map +0 -1
- package/dist/error-handling-middleware.js.map +0 -1
- package/dist/handlers/get-service-url.d.ts +0 -3
- package/dist/handlers/get-service-url.d.ts.map +0 -1
- package/dist/handlers/get-service-url.js +0 -11
- package/dist/handlers/get-service-url.js.map +0 -1
- package/dist/start.d.ts +0 -2
- package/dist/start.d.ts.map +0 -1
- package/dist/start.js +0 -77
- package/dist/start.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { faker } from "@faker-js/faker";
|
|
3
|
+
export const auth0UserSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
id: z.string().default(""),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
password: z.string().optional().default("12345"),
|
|
8
|
+
email: z.string().email().optional(),
|
|
9
|
+
picture: z.string().url().optional(),
|
|
10
|
+
})
|
|
11
|
+
.transform((user) => {
|
|
12
|
+
if (!user.email)
|
|
13
|
+
user.email = faker.internet.email({ firstName: user.name });
|
|
14
|
+
user.id = faker.database.mongodbObjectId();
|
|
15
|
+
if (!user.picture)
|
|
16
|
+
user.picture = faker.image.avatar();
|
|
17
|
+
return user;
|
|
18
|
+
});
|
|
19
|
+
export const defaultUser = auth0UserSchema.parse({
|
|
20
|
+
name: "default",
|
|
21
|
+
email: "default@example.com",
|
|
22
|
+
});
|
|
23
|
+
export const auth0InitialStoreSchema = z.object({
|
|
24
|
+
users: z.array(auth0UserSchema),
|
|
25
|
+
});
|
|
26
|
+
export const convertToObj = (arrayOfObjects, key = "id") => arrayOfObjects.reduce((final, obj) => {
|
|
27
|
+
final[obj[key]] = obj;
|
|
28
|
+
return final;
|
|
29
|
+
}, {});
|
|
30
|
+
export const convertInitialStateToStoreState = (initialState) => {
|
|
31
|
+
if (!initialState)
|
|
32
|
+
return undefined;
|
|
33
|
+
const storeObject = {
|
|
34
|
+
users: convertToObj(initialState.users, "id"),
|
|
35
|
+
};
|
|
36
|
+
return storeObject;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/store/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAChD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC;KACD,SAAS,CAAC,CAAC,IAA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
1
|
+
import type { SimulationStore, ExtendSimulationSchema, ExtendSimulationSchemaInput, ExtendSimulationActions, ExtendSimulationActionsInput, ExtendSimulationSelectors, ExtendSimulationSelectorsInput, TableOutput, AnyState } from "@simulacrum/foundation-simulator";
|
|
2
|
+
import { type Auth0User, type AuthSession, Auth0InitialStore } from "./entities";
|
|
3
|
+
export type ExtendedSchema = ({ slice }: ExtendSimulationSchema) => {
|
|
4
|
+
sessions: (n: string) => TableOutput<AuthSession, AnyState, AuthSession | undefined>;
|
|
5
|
+
users: (n: string) => TableOutput<Auth0User, AnyState, Auth0User | undefined>;
|
|
6
|
+
};
|
|
7
|
+
type ExtendActions = typeof inputActions;
|
|
8
|
+
type ExtendSelectors = typeof inputSelectors;
|
|
9
|
+
export type ExtendedSimulationStore = SimulationStore<ReturnType<ExtendedSchema>, ReturnType<ExtendActions>, ReturnType<ExtendSelectors>>;
|
|
10
|
+
declare const inputActions: (args: ExtendSimulationActions<ExtendedSchema>) => {};
|
|
11
|
+
declare const inputSelectors: (args: ExtendSimulationSelectors<ExtendedSchema>) => {};
|
|
12
|
+
export declare const extendStore: <T>(initialState: Auth0InitialStore | undefined, extended: {
|
|
13
|
+
actions: ExtendSimulationActionsInput<any, ExtendSimulationSchemaInput<T>>;
|
|
14
|
+
selectors: ExtendSimulationSelectorsInput<any, ExtendSimulationSchemaInput<T>>;
|
|
15
|
+
schema?: ExtendSimulationSchemaInput<T>;
|
|
16
|
+
} | undefined) => {
|
|
17
|
+
actions: (args: ExtendSimulationActions<ExtendedSchema>) => any;
|
|
18
|
+
selectors: (args: ExtendSimulationSelectors<ExtendedSchema>) => any;
|
|
19
|
+
schema: ({ slice }: ExtendSimulationSchema) => {
|
|
20
|
+
sessions: (n: string) => TableOutput<AuthSession, AnyState, AuthSession | undefined>;
|
|
21
|
+
users: (n: string) => TableOutput<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
password: string;
|
|
25
|
+
email?: string | undefined;
|
|
26
|
+
picture?: string | undefined;
|
|
27
|
+
}, AnyState, {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
password: string;
|
|
31
|
+
email?: string | undefined;
|
|
32
|
+
picture?: string | undefined;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC9B,WAAW,EACX,QAAQ,EACT,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,sBAAsB,KAAK;IAClE,QAAQ,EAAE,CACR,CAAC,EAAE,MAAM,KACN,WAAW,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IACjE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;CAC/E,CAAC;AACF,KAAK,aAAa,GAAG,OAAO,YAAY,CAAC;AACzC,KAAK,eAAe,GAAG,OAAO,cAAc,CAAC;AAC7C,MAAM,MAAM,uBAAuB,GAAG,eAAe,CACnD,UAAU,CAAC,cAAc,CAAC,EAC1B,UAAU,CAAC,aAAa,CAAC,EACzB,UAAU,CAAC,eAAe,CAAC,CAC5B,CAAC;AA2BF,QAAA,MAAM,YAAY,SAAU,uBAAuB,CAAC,cAAc,CAAC,OAElE,CAAC;AAWF,QAAA,MAAM,cAAc,SAAU,yBAAyB,CAAC,cAAc,CAAC,OAGtE,CAAC;AAWF,eAAO,MAAM,WAAW,GAAI,CAAC,gBACb,iBAAiB,GAAG,SAAS,YAEvC;IACE,OAAO,EAAE,4BAA4B,CACnC,GAAG,EACH,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;IACF,SAAS,EAAE,8BAA8B,CACvC,GAAG,EACH,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;IACF,MAAM,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;CACzC,GACD,SAAS;oBAnCN,uBAAuB,CAAC,cAAc,CAAC;sBAcvC,yBAAyB,CAAC,cAAc,CAAC;wBAxCpC,sBAAsB;;;;;;;;;;;;;;;;CAkElC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { convertInitialStateToStoreState, defaultUser, } from "./entities";
|
|
2
|
+
const inputSchema = (initialState, extendedSchema) => ({ slice }) => {
|
|
3
|
+
const storeInitialState = convertInitialStateToStoreState(initialState);
|
|
4
|
+
const extended = extendedSchema ? extendedSchema({ slice }) : {};
|
|
5
|
+
let slices = {
|
|
6
|
+
sessions: slice.table(),
|
|
7
|
+
users: slice.table({
|
|
8
|
+
...(!storeInitialState
|
|
9
|
+
? {
|
|
10
|
+
initialState: {
|
|
11
|
+
[defaultUser.id]: defaultUser,
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
: { initialState: storeInitialState.users }),
|
|
15
|
+
}),
|
|
16
|
+
...extended,
|
|
17
|
+
};
|
|
18
|
+
return slices;
|
|
19
|
+
};
|
|
20
|
+
const inputActions = (args) => {
|
|
21
|
+
return {};
|
|
22
|
+
};
|
|
23
|
+
const extendActions = (extendedActions) => (args) => {
|
|
24
|
+
return extendedActions
|
|
25
|
+
? // @ts-expect-error schema is cyclical, ignore extension for now
|
|
26
|
+
{ ...inputActions(args), ...extendedActions(args) }
|
|
27
|
+
: inputActions(args);
|
|
28
|
+
};
|
|
29
|
+
const inputSelectors = (args) => {
|
|
30
|
+
const { createSelector, schema } = args;
|
|
31
|
+
return {};
|
|
32
|
+
};
|
|
33
|
+
const extendSelectors = (extendedSelectors) => (args) => {
|
|
34
|
+
return extendedSelectors
|
|
35
|
+
? // @ts-expect-error schema is cyclical, ignore extension for now
|
|
36
|
+
{ ...inputSelectors(args), ...extendedSelectors(args) }
|
|
37
|
+
: inputSelectors(args);
|
|
38
|
+
};
|
|
39
|
+
export const extendStore = (initialState, extended) => ({
|
|
40
|
+
actions: extendActions(extended === null || extended === void 0 ? void 0 : extended.actions),
|
|
41
|
+
selectors: extendSelectors(extended === null || extended === void 0 ? void 0 : extended.selectors),
|
|
42
|
+
schema: inputSchema(initialState, extended === null || extended === void 0 ? void 0 : extended.schema),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,+BAA+B,EAC/B,WAAW,GAIZ,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,GACf,CACE,YAAgC,EAChC,cAA+C,EAC/C,EAAE,CACJ,CAAC,EAAE,KAAK,EAA0B,EAAE,EAAE;IACpC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC,YAAY,CAAC,CAAC;IAExE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,IAAI,MAAM,GAAG;QACX,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAe;QACpC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAY;YAC5B,GAAG,CAAC,CAAC,iBAAiB;gBACpB,CAAC,CAAC;oBACE,YAAY,EAAE;wBACZ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,WAAW;qBAC9B;iBACF;gBACH,CAAC,CAAC,EAAE,YA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,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC;CACpD,CAAC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const configurationSchema: z.ZodObject<{
|
|
3
3
|
port: z.ZodOptional<z.ZodNumber>;
|
|
4
4
|
domain: z.ZodOptional<z.ZodString>;
|
|
@@ -9,13 +9,13 @@ export declare const configurationSchema: z.ZodObject<{
|
|
|
9
9
|
audience: z.ZodOptional<z.ZodString>;
|
|
10
10
|
scope: z.ZodString;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
audience?: string | undefined;
|
|
13
12
|
clientID: string;
|
|
14
13
|
scope: string;
|
|
15
|
-
}, {
|
|
16
14
|
audience?: string | undefined;
|
|
15
|
+
}, {
|
|
17
16
|
clientID: string;
|
|
18
17
|
scope: string;
|
|
18
|
+
audience?: string | undefined;
|
|
19
19
|
}>, "many">]>;
|
|
20
20
|
clientSecret: z.ZodOptional<z.ZodString>;
|
|
21
21
|
rulesDirectory: z.ZodOptional<z.ZodString>;
|
|
@@ -24,6 +24,11 @@ export declare const configurationSchema: z.ZodObject<{
|
|
|
24
24
|
connection: z.ZodOptional<z.ZodString>;
|
|
25
25
|
cookieSecret: z.ZodOptional<z.ZodString>;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
scope: string | {
|
|
28
|
+
clientID: string;
|
|
29
|
+
scope: string;
|
|
30
|
+
audience?: string | undefined;
|
|
31
|
+
}[];
|
|
27
32
|
port?: number | undefined;
|
|
28
33
|
domain?: string | undefined;
|
|
29
34
|
audience?: string | undefined;
|
|
@@ -34,12 +39,12 @@ export declare const configurationSchema: z.ZodObject<{
|
|
|
34
39
|
auth0CookieSecret?: string | undefined;
|
|
35
40
|
connection?: string | undefined;
|
|
36
41
|
cookieSecret?: string | undefined;
|
|
42
|
+
}, {
|
|
37
43
|
scope: string | {
|
|
38
|
-
audience?: string | undefined;
|
|
39
44
|
clientID: string;
|
|
40
45
|
scope: string;
|
|
46
|
+
audience?: string | undefined;
|
|
41
47
|
}[];
|
|
42
|
-
}, {
|
|
43
48
|
port?: number | undefined;
|
|
44
49
|
domain?: string | undefined;
|
|
45
50
|
audience?: string | undefined;
|
|
@@ -50,23 +55,18 @@ export declare const configurationSchema: z.ZodObject<{
|
|
|
50
55
|
auth0CookieSecret?: string | undefined;
|
|
51
56
|
connection?: string | undefined;
|
|
52
57
|
cookieSecret?: string | undefined;
|
|
53
|
-
scope: string | {
|
|
54
|
-
audience?: string | undefined;
|
|
55
|
-
clientID: string;
|
|
56
|
-
scope: string;
|
|
57
|
-
}[];
|
|
58
58
|
}>;
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
export
|
|
62
|
-
export
|
|
59
|
+
export type ConfigSchema = z.infer<typeof configurationSchema>;
|
|
60
|
+
type ReadonlyFields = "audience" | "clientID" | "scope" | "port";
|
|
61
|
+
export type GrantType = "password" | "client_credentials" | "authorization_code" | "refresh_token";
|
|
62
|
+
export type ScopeConfig = string | {
|
|
63
63
|
audience?: string;
|
|
64
64
|
clientID: string;
|
|
65
65
|
scope: string;
|
|
66
66
|
}[];
|
|
67
|
-
export
|
|
68
|
-
export
|
|
69
|
-
export
|
|
67
|
+
export type Auth0Configuration = Required<Pick<ConfigSchema, ReadonlyFields>> & Omit<ConfigSchema, ReadonlyFields>;
|
|
68
|
+
export type ResponseModes = "query" | "web_message";
|
|
69
|
+
export type QueryParams = {
|
|
70
70
|
state: string;
|
|
71
71
|
code: string;
|
|
72
72
|
redirect_uri: string;
|
|
@@ -121,10 +121,10 @@ export interface RefreshToken {
|
|
|
121
121
|
};
|
|
122
122
|
nonce?: string;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
type Token<P> = {
|
|
125
125
|
payload: P;
|
|
126
126
|
};
|
|
127
|
-
export
|
|
128
|
-
export
|
|
127
|
+
export type IdToken = Token<IdTokenData>;
|
|
128
|
+
export type AccessToken = Token<AccessTokenPayload>;
|
|
129
129
|
export {};
|
|
130
130
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B9B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE/D,KAAK,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAIjE,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,oBAAoB,GACpB,oBAAoB,GACpB,eAAe,CAAC;AAEpB,MAAM,MAAM,WAAW,GACnB,MAAM,GACN;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,GAC3E,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACrC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,aAAa,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,C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E,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,KAAK,CAAC,CAAC,IAAI;IACd,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
// TODO: better validation
|
|
6
|
-
exports.configurationSchema = zod_1.z.object({
|
|
7
|
-
port: zod_1.z.optional(zod_1.z
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const configurationSchema = z.object({
|
|
3
|
+
port: z.optional(z
|
|
8
4
|
.number()
|
|
9
|
-
.gt(2999,
|
|
10
|
-
.lt(10000,
|
|
11
|
-
domain:
|
|
12
|
-
audience:
|
|
13
|
-
clientID:
|
|
14
|
-
scope:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
clientID:
|
|
18
|
-
audience:
|
|
19
|
-
scope:
|
|
20
|
-
}))
|
|
5
|
+
.gt(2999, "port must be greater than 2999")
|
|
6
|
+
.lt(10000, "must be less than 10000")),
|
|
7
|
+
domain: z.optional(z.string().min(1, "domain is required")),
|
|
8
|
+
audience: z.optional(z.string().min(1, "audience is required")),
|
|
9
|
+
clientID: z.optional(z.string().max(32, "must be 32 characters long")),
|
|
10
|
+
scope: z.union([
|
|
11
|
+
z.string().min(1, "scope is required"),
|
|
12
|
+
z.array(z.object({
|
|
13
|
+
clientID: z.string().max(32, "must be 32 characters long"),
|
|
14
|
+
audience: z.optional(z.string().min(1, "audience is required")),
|
|
15
|
+
scope: z.string().min(1, "scope is required"),
|
|
16
|
+
})),
|
|
21
17
|
]),
|
|
22
|
-
clientSecret:
|
|
23
|
-
rulesDirectory:
|
|
24
|
-
auth0SessionCookieName:
|
|
25
|
-
auth0CookieSecret:
|
|
26
|
-
connection:
|
|
27
|
-
cookieSecret:
|
|
18
|
+
clientSecret: z.optional(z.string()),
|
|
19
|
+
rulesDirectory: z.optional(z.string()),
|
|
20
|
+
auth0SessionCookieName: z.optional(z.string()),
|
|
21
|
+
auth0CookieSecret: z.optional(z.string()),
|
|
22
|
+
connection: z.optional(z.string()),
|
|
23
|
+
cookieSecret: z.optional(z.string()),
|
|
28
24
|
});
|
|
29
25
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,QAAQ,CACd,CAAC;SACE,MAAM,EAAE;SACR,EAAE,CAAC,IAAI,EAAE,gCAAgC,CAAC;SAC1C,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,CACxC;IACD,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC3D,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAC/D,QAAQ,EAAE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opeConfig;
|
|
@@ -7,6 +7,6 @@ interface LoginViewProps {
|
|
|
7
7
|
audience: string;
|
|
8
8
|
loginFailed: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare const loginView: ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed }: LoginViewProps) => string;
|
|
10
|
+
export declare const loginView: ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed, }: LoginViewProps) => string;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,kFAOnB,cAAc,KAAG,MA4InB,CAAC"}
|
package/dist/views/login.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loginView = void 0;
|
|
4
|
-
const utils_1 = require("../handlers/utils");
|
|
1
|
+
import { deriveScope } from "../handlers/utils";
|
|
5
2
|
const html = String.raw;
|
|
6
|
-
const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed = false }) => {
|
|
3
|
+
export const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed = false, }) => {
|
|
7
4
|
return html `
|
|
8
5
|
<html lang="en">
|
|
9
6
|
<head>
|
|
@@ -17,10 +14,16 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
17
14
|
</head>
|
|
18
15
|
<title>login</title>
|
|
19
16
|
<body>
|
|
20
|
-
<main
|
|
17
|
+
<main
|
|
18
|
+
class="min-h-screen flex items-center justify-center bg-white py-12 px-4 sm:px-6 lg:px-8"
|
|
19
|
+
>
|
|
21
20
|
<div class="max-w-md w-full space-y-8">
|
|
22
21
|
<div class="flex justify-center">
|
|
23
|
-
<img
|
|
22
|
+
<img
|
|
23
|
+
alt="frontside"
|
|
24
|
+
class="bg-transparent object-contain h-16"
|
|
25
|
+
src="/img/frontside-logo.png"
|
|
26
|
+
/>
|
|
24
27
|
</div>
|
|
25
28
|
<h1 class="flex justify-center text-4xl">Welcome</h1>
|
|
26
29
|
<h2 class="flex justify-center">Login to continue to frontside</h2>
|
|
@@ -28,20 +31,64 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
28
31
|
<div class="rounded-md shadow-sm -space-y-px">
|
|
29
32
|
<div>
|
|
30
33
|
<label for="username" class="sr-only">Email address</label>
|
|
31
|
-
<input
|
|
34
|
+
<input
|
|
35
|
+
id="username"
|
|
36
|
+
name="username"
|
|
37
|
+
type="email"
|
|
38
|
+
autocomplete="email"
|
|
39
|
+
required=""
|
|
40
|
+
value=""
|
|
41
|
+
class="${loginFailed
|
|
42
|
+
? "border-red-500"
|
|
43
|
+
: ""} appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
|
|
44
|
+
placeholder="Email address"
|
|
45
|
+
/>
|
|
32
46
|
</div>
|
|
33
47
|
<div>
|
|
34
48
|
<label for="password" class="sr-only">Password</label>
|
|
35
|
-
<input
|
|
49
|
+
<input
|
|
50
|
+
id="password"
|
|
51
|
+
name="password"
|
|
52
|
+
type="password"
|
|
53
|
+
autocomplete="current-password"
|
|
54
|
+
required=""
|
|
55
|
+
class="my-4 ${loginFailed
|
|
56
|
+
? "border-red-500"
|
|
57
|
+
: ""} appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
|
|
58
|
+
placeholder="Password"
|
|
59
|
+
/>
|
|
36
60
|
</div>
|
|
37
61
|
</div>
|
|
38
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
class="error bg-red-500 text-white p-3 ${loginFailed
|
|
64
|
+
? ""
|
|
65
|
+
: "hidden"}"
|
|
66
|
+
>
|
|
67
|
+
Wrong email or password
|
|
68
|
+
</div>
|
|
39
69
|
|
|
40
70
|
<div>
|
|
41
|
-
<button
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
<button
|
|
72
|
+
id="submit"
|
|
73
|
+
type="submit"
|
|
74
|
+
class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
75
|
+
>
|
|
76
|
+
<span
|
|
77
|
+
class="absolute left-0 inset-y-0 flex items-center pl-3"
|
|
78
|
+
>
|
|
79
|
+
<svg
|
|
80
|
+
class="h-5 w-5 text-blue-500 group-hover:text-blue-400"
|
|
81
|
+
x-description="Heroicon name: solid/lock-closed"
|
|
82
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
83
|
+
viewBox="0 0 20 20"
|
|
84
|
+
fill="currentColor"
|
|
85
|
+
aria-hidden="true"
|
|
86
|
+
>
|
|
87
|
+
<path
|
|
88
|
+
fill-rule="evenodd"
|
|
89
|
+
d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
|
|
90
|
+
clip-rule="evenodd"
|
|
91
|
+
></path>
|
|
45
92
|
</svg>
|
|
46
93
|
</span>
|
|
47
94
|
Sign in
|
|
@@ -51,47 +98,47 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
51
98
|
</div>
|
|
52
99
|
</main>
|
|
53
100
|
<script>
|
|
54
|
-
document.addEventListener(
|
|
101
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
55
102
|
var webAuth = new window.auth0.default.WebAuth({
|
|
56
|
-
domain:
|
|
57
|
-
clientID:
|
|
58
|
-
redirectUri:
|
|
59
|
-
audience:
|
|
60
|
-
responseType:
|
|
103
|
+
domain: "${domain}",
|
|
104
|
+
clientID: "${clientID}",
|
|
105
|
+
redirectUri: "${redirectUri}",
|
|
106
|
+
audience: "${audience}",
|
|
107
|
+
responseType: "token id_token",
|
|
61
108
|
});
|
|
62
|
-
var form = document.querySelector(
|
|
109
|
+
var form = document.querySelector("#the-form");
|
|
63
110
|
|
|
64
|
-
form.addEventListener(
|
|
111
|
+
form.addEventListener("submit", function (e) {
|
|
65
112
|
event.preventDefault();
|
|
66
|
-
event.stopPropagation()
|
|
113
|
+
event.stopPropagation();
|
|
67
114
|
let params = new URLSearchParams(window.location.search);
|
|
68
115
|
|
|
69
|
-
var username = document.querySelector(
|
|
70
|
-
var password = document.querySelector(
|
|
116
|
+
var username = document.querySelector("#username");
|
|
117
|
+
var password = document.querySelector("#password");
|
|
71
118
|
|
|
72
119
|
webAuth.login(
|
|
73
120
|
{
|
|
74
121
|
username: username.value,
|
|
75
122
|
password: password.value,
|
|
76
|
-
realm:
|
|
77
|
-
scope:
|
|
78
|
-
nonce: params.get(
|
|
79
|
-
state: params.get(
|
|
123
|
+
realm: "Username-Password-Authentication",
|
|
124
|
+
scope: "${deriveScope({ scopeConfig, clientID, audience })}",
|
|
125
|
+
nonce: params.get("nonce"),
|
|
126
|
+
state: params.get("state"),
|
|
80
127
|
},
|
|
81
|
-
function(err, authResult) {
|
|
128
|
+
function (err, authResult) {
|
|
82
129
|
if (err) {
|
|
83
|
-
[username, password].forEach(e =>
|
|
84
|
-
|
|
130
|
+
[username, password].forEach((e) =>
|
|
131
|
+
e.classList.add("border-red-500")
|
|
132
|
+
);
|
|
133
|
+
document.querySelector(".error").classList.remove("hidden");
|
|
85
134
|
}
|
|
86
135
|
}
|
|
87
136
|
);
|
|
88
137
|
});
|
|
89
138
|
});
|
|
90
|
-
|
|
91
139
|
</script>
|
|
92
140
|
</body>
|
|
93
141
|
</html>
|
|
94
142
|
`;
|
|
95
143
|
};
|
|
96
|
-
exports.loginView = loginView;
|
|
97
144
|
//# sourceMappingURL=login.js.map
|
package/dist/views/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAWxB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,MAAM,EACN,KAAK,EAAE,WAAW,EAClB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,GAAG,KAAK,GACJ,EAAU,EAAE;IAC3B,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAqCgB,WAAW;QAClB,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,EAAE;;;;;;;;;;;;kCAYQ,WAAW;QACvB,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,EAAE;;;;;;yDAM+B,WAAW;QAClD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAsCH,MAAM;2BACJ,QAAQ;8BACL,WAAW;2BACd,QAAQ;;;;;;;;;;;;;;;;;;4BAkBP,WAAW,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;;;;;;;;;;;;;;;;;;GAkBzE,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"username-password.d.ts","sourceRoot":"","sources":["../../src/views/username-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,
|
|
1
|
+
{"version":3,"file":"username-password.d.ts","sourceRoot":"","sources":["../../src/views/username-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEzB,eAAO,MAAM,oBAAoB,gHAW9B,oBAAoB,KAAG,MA+BzB,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const html_entities_1 = require("html-entities");
|
|
5
|
-
const userNamePasswordForm = ({ auth0Domain = "/login/callback", redirect_uri, state, nonce, client_id, scope, audience, connection, response_type, tenant, }) => {
|
|
6
|
-
let wctx = (0, html_entities_1.encode)(JSON.stringify({
|
|
1
|
+
import { encode } from "html-entities";
|
|
2
|
+
export const userNamePasswordForm = ({ auth0Domain = "/login/callback", redirect_uri, state, nonce, client_id, scope, audience, connection, response_type, tenant, }) => {
|
|
3
|
+
let wctx = encode(JSON.stringify({
|
|
7
4
|
strategy: "auth0",
|
|
8
5
|
tenant,
|
|
9
6
|
connection,
|
|
@@ -31,5 +28,4 @@ const userNamePasswordForm = ({ auth0Domain = "/login/callback", redirect_uri, s
|
|
|
31
28
|
</noscript>
|
|
32
29
|
</form>`;
|
|
33
30
|
};
|
|
34
|
-
exports.userNamePasswordForm = userNamePasswordForm;
|
|
35
31
|
//# sourceMappingURL=username-password.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"username-password.js","sourceRoot":"","sources":["../../src/views/username-password.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"username-password.js","sourceRoot":"","sources":["../../src/views/username-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAWvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,WAAW,GAAG,iBAAiB,EAC/B,YAAY,EACZ,KAAK,EACL,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,MAAM,GACe,EAAU,EAAE;IACjC,IAAI,IAAI,GAAG,MAAM,CACf,IAAI,CAAC,SAAS,CAAC;QACb,QAAQ,EAAE,OAAO;QACjB,MAAM;QACN,UAAU;QACV,SAAS;QACT,aAAa;QACb,KAAK;QACL,YAAY;QACZ,KAAK;QACL,KAAK;QACL,QAAQ;QACR,KAAK,EAAE,UAAU;KAClB,CAAC,CACH,CAAC;IAEF,OAAO;kDACyC,WAAW;;;;;8CAKf,IAAI;;;;;;;UAOxC,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { QueryParams } from
|
|
1
|
+
import type { QueryParams } from "../types";
|
|
2
2
|
export declare const webMessage: ({ state, code, redirect_uri, nonce, }: Pick<QueryParams, "state" | "code" | "redirect_uri" | "nonce">) => string;
|
|
3
3
|
//# sourceMappingURL=web-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-message.d.ts","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,UAAU,0CAKpB,
|
|
1
|
+
{"version":3,"file":"web-message.d.ts","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,UAAU,0CAKpB,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC,KAAG,MA4DnE,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.webMessage = void 0;
|
|
7
|
-
const jsesc_1 = __importDefault(require("jsesc"));
|
|
8
|
-
const webMessage = ({ state, code, redirect_uri, nonce, }) => {
|
|
9
|
-
let data = (0, jsesc_1.default)({
|
|
1
|
+
import jsesc from "jsesc";
|
|
2
|
+
export const webMessage = ({ state, code, redirect_uri, nonce, }) => {
|
|
3
|
+
let data = jsesc({
|
|
10
4
|
redirect_uri,
|
|
11
5
|
}, { json: true, isScriptContext: true });
|
|
12
6
|
return `
|
|
@@ -62,5 +56,4 @@ const webMessage = ({ state, code, redirect_uri, nonce, }) => {
|
|
|
62
56
|
</html>
|
|
63
57
|
`;
|
|
64
58
|
};
|
|
65
|
-
exports.webMessage = webMessage;
|
|
66
59
|
//# sourceMappingURL=web-message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-message.js","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-message.js","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,GAC0D,EAAU,EAAE;IAC3E,IAAI,IAAI,GAAG,KAAK,CACd;QACE,YAAY;KACb,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CACtC,CAAC;IAEF,OAAO;;;;;;;gBAOO,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;;uBAExB,IAAI;;;;;;;wBAOH,IAAI;yBACH,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkC3B,CAAC;AACJ,CAAC,CAAC"}
|