@simulacrum/auth0-simulator 0.9.0 → 0.10.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/README.md +28 -206
- package/bin/start.js +14 -0
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/date.d.ts.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 +5 -5
- 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 +7 -8
- 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 +10 -10
- 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 +96 -70
- 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 +43 -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.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 +56 -50
- 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 +10 -10
- package/dist/handlers/openid-handlers.js.map +1 -1
- package/dist/handlers/url.d.ts.map +1 -1
- package/dist/handlers/url.js +1 -1
- 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 +5 -4
- 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 +3 -3
- 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 +22 -125
- package/dist/index.js.map +1 -1
- package/dist/middleware/create-cors.d.ts +1 -1
- 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 -8
- package/dist/middleware/error-handling.js.map +1 -0
- package/dist/middleware/no-cache.d.ts +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.js.map +1 -1
- package/dist/rules/extensionless-file-name.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.js +7 -8
- 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 +49 -41
- 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/store/entities.d.ts +111 -0
- package/dist/store/entities.d.ts.map +1 -0
- package/dist/store/entities.js +43 -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 +40 -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 +10 -11
- 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 -30
- 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/web-message.d.ts +1 -1
- package/dist/views/web-message.d.ts.map +1 -1
- package/dist/views/web-message.js.map +1 -1
- package/package.json +26 -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
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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AC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IAEd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,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
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configurationSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
// TODO: better validation
|
|
6
5
|
exports.configurationSchema = zod_1.z.object({
|
|
7
6
|
port: zod_1.z.optional(zod_1.z
|
|
8
7
|
.number()
|
|
9
|
-
.gt(2999,
|
|
10
|
-
.lt(10000,
|
|
11
|
-
domain: zod_1.z.optional(zod_1.z.string().min(1,
|
|
12
|
-
audience: zod_1.z.optional(zod_1.z.string().min(1,
|
|
13
|
-
clientID: zod_1.z.optional(zod_1.z.string().max(32,
|
|
8
|
+
.gt(2999, "port must be greater than 2999")
|
|
9
|
+
.lt(10000, "must be less than 10000")),
|
|
10
|
+
domain: zod_1.z.optional(zod_1.z.string().min(1, "domain is required")),
|
|
11
|
+
audience: zod_1.z.optional(zod_1.z.string().min(1, "audience is required")),
|
|
12
|
+
clientID: zod_1.z.optional(zod_1.z.string().max(32, "must be 32 characters long")),
|
|
14
13
|
scope: zod_1.z.union([
|
|
15
|
-
zod_1.z.string().min(1,
|
|
14
|
+
zod_1.z.string().min(1, "scope is required"),
|
|
16
15
|
zod_1.z.array(zod_1.z.object({
|
|
17
|
-
clientID: zod_1.z.string().max(32,
|
|
18
|
-
audience: zod_1.z.optional(zod_1.z.string().min(1,
|
|
19
|
-
scope: zod_1.z.string().min(1,
|
|
20
|
-
}))
|
|
16
|
+
clientID: zod_1.z.string().max(32, "must be 32 characters long"),
|
|
17
|
+
audience: zod_1.z.optional(zod_1.z.string().min(1, "audience is required")),
|
|
18
|
+
scope: zod_1.z.string().min(1, "scope is required"),
|
|
19
|
+
})),
|
|
21
20
|
]),
|
|
22
21
|
clientSecret: zod_1.z.optional(zod_1.z.string()),
|
|
23
22
|
rulesDirectory: zod_1.z.optional(zod_1.z.string()),
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,OAAC,CAAC,QAAQ,CACd,OAAC;SACE,MAAM,EAAE;SACR,EAAE,CAAC,IAAI,EAAE,gCAAgC,CAAC;SAC1C,EAAE,CAAC,K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C,MAAM,EAAE,CAAC;IAClC,YAAY,EAAE,OAAC,CAAC,QAAQ,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC"}
|
package/dist/views/login.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScopeConfig } from
|
|
1
|
+
import type { ScopeConfig } from "../types.ts";
|
|
2
2
|
interface LoginViewProps {
|
|
3
3
|
domain: string;
|
|
4
4
|
scope: ScopeConfig;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,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,GAAI,+EAOvB,cAAc,KAAG,MA4InB,CAAC"}
|
package/dist/views/login.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loginView = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_ts_1 = require("../handlers/utils.js");
|
|
5
5
|
const html = String.raw;
|
|
6
|
-
const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed = false }) => {
|
|
6
|
+
const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience, loginFailed = false, }) => {
|
|
7
7
|
return html `
|
|
8
8
|
<html lang="en">
|
|
9
9
|
<head>
|
|
@@ -17,10 +17,16 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
17
17
|
</head>
|
|
18
18
|
<title>login</title>
|
|
19
19
|
<body>
|
|
20
|
-
<main
|
|
20
|
+
<main
|
|
21
|
+
class="min-h-screen flex items-center justify-center bg-white py-12 px-4 sm:px-6 lg:px-8"
|
|
22
|
+
>
|
|
21
23
|
<div class="max-w-md w-full space-y-8">
|
|
22
24
|
<div class="flex justify-center">
|
|
23
|
-
<img
|
|
25
|
+
<img
|
|
26
|
+
alt="frontside"
|
|
27
|
+
class="bg-transparent object-contain h-16"
|
|
28
|
+
src="/img/frontside-logo.png"
|
|
29
|
+
/>
|
|
24
30
|
</div>
|
|
25
31
|
<h1 class="flex justify-center text-4xl">Welcome</h1>
|
|
26
32
|
<h2 class="flex justify-center">Login to continue to frontside</h2>
|
|
@@ -28,20 +34,64 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
28
34
|
<div class="rounded-md shadow-sm -space-y-px">
|
|
29
35
|
<div>
|
|
30
36
|
<label for="username" class="sr-only">Email address</label>
|
|
31
|
-
<input
|
|
37
|
+
<input
|
|
38
|
+
id="username"
|
|
39
|
+
name="username"
|
|
40
|
+
type="email"
|
|
41
|
+
autocomplete="email"
|
|
42
|
+
required=""
|
|
43
|
+
value=""
|
|
44
|
+
class="${loginFailed
|
|
45
|
+
? "border-red-500"
|
|
46
|
+
: ""} 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"
|
|
47
|
+
placeholder="Email address"
|
|
48
|
+
/>
|
|
32
49
|
</div>
|
|
33
50
|
<div>
|
|
34
51
|
<label for="password" class="sr-only">Password</label>
|
|
35
|
-
<input
|
|
52
|
+
<input
|
|
53
|
+
id="password"
|
|
54
|
+
name="password"
|
|
55
|
+
type="password"
|
|
56
|
+
autocomplete="current-password"
|
|
57
|
+
required=""
|
|
58
|
+
class="my-4 ${loginFailed
|
|
59
|
+
? "border-red-500"
|
|
60
|
+
: ""} 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"
|
|
61
|
+
placeholder="Password"
|
|
62
|
+
/>
|
|
36
63
|
</div>
|
|
37
64
|
</div>
|
|
38
|
-
<div
|
|
65
|
+
<div
|
|
66
|
+
class="error bg-red-500 text-white p-3 ${loginFailed
|
|
67
|
+
? ""
|
|
68
|
+
: "hidden"}"
|
|
69
|
+
>
|
|
70
|
+
Wrong email or password
|
|
71
|
+
</div>
|
|
39
72
|
|
|
40
73
|
<div>
|
|
41
|
-
<button
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
74
|
+
<button
|
|
75
|
+
id="submit"
|
|
76
|
+
type="submit"
|
|
77
|
+
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"
|
|
78
|
+
>
|
|
79
|
+
<span
|
|
80
|
+
class="absolute left-0 inset-y-0 flex items-center pl-3"
|
|
81
|
+
>
|
|
82
|
+
<svg
|
|
83
|
+
class="h-5 w-5 text-blue-500 group-hover:text-blue-400"
|
|
84
|
+
x-description="Heroicon name: solid/lock-closed"
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
viewBox="0 0 20 20"
|
|
87
|
+
fill="currentColor"
|
|
88
|
+
aria-hidden="true"
|
|
89
|
+
>
|
|
90
|
+
<path
|
|
91
|
+
fill-rule="evenodd"
|
|
92
|
+
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"
|
|
93
|
+
clip-rule="evenodd"
|
|
94
|
+
></path>
|
|
45
95
|
</svg>
|
|
46
96
|
</span>
|
|
47
97
|
Sign in
|
|
@@ -51,43 +101,44 @@ const loginView = ({ domain, scope: scopeConfig, redirectUri, clientID, audience
|
|
|
51
101
|
</div>
|
|
52
102
|
</main>
|
|
53
103
|
<script>
|
|
54
|
-
document.addEventListener(
|
|
104
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
55
105
|
var webAuth = new window.auth0.default.WebAuth({
|
|
56
|
-
domain:
|
|
57
|
-
clientID:
|
|
58
|
-
redirectUri:
|
|
59
|
-
audience:
|
|
60
|
-
responseType:
|
|
106
|
+
domain: "${domain}",
|
|
107
|
+
clientID: "${clientID}",
|
|
108
|
+
redirectUri: "${redirectUri}",
|
|
109
|
+
audience: "${audience}",
|
|
110
|
+
responseType: "token id_token",
|
|
61
111
|
});
|
|
62
|
-
var form = document.querySelector(
|
|
112
|
+
var form = document.querySelector("#the-form");
|
|
63
113
|
|
|
64
|
-
form.addEventListener(
|
|
114
|
+
form.addEventListener("submit", function (e) {
|
|
65
115
|
event.preventDefault();
|
|
66
|
-
event.stopPropagation()
|
|
116
|
+
event.stopPropagation();
|
|
67
117
|
let params = new URLSearchParams(window.location.search);
|
|
68
118
|
|
|
69
|
-
var username = document.querySelector(
|
|
70
|
-
var password = document.querySelector(
|
|
119
|
+
var username = document.querySelector("#username");
|
|
120
|
+
var password = document.querySelector("#password");
|
|
71
121
|
|
|
72
122
|
webAuth.login(
|
|
73
123
|
{
|
|
74
124
|
username: username.value,
|
|
75
125
|
password: password.value,
|
|
76
|
-
realm:
|
|
77
|
-
scope:
|
|
78
|
-
nonce: params.get(
|
|
79
|
-
state: params.get(
|
|
126
|
+
realm: "Username-Password-Authentication",
|
|
127
|
+
scope: "${(0, utils_ts_1.deriveScope)({ scopeConfig, clientID, audience })}",
|
|
128
|
+
nonce: params.get("nonce"),
|
|
129
|
+
state: params.get("state"),
|
|
80
130
|
},
|
|
81
|
-
function(err, authResult) {
|
|
131
|
+
function (err, authResult) {
|
|
82
132
|
if (err) {
|
|
83
|
-
[username, password].forEach(e =>
|
|
84
|
-
|
|
133
|
+
[username, password].forEach((e) =>
|
|
134
|
+
e.classList.add("border-red-500")
|
|
135
|
+
);
|
|
136
|
+
document.querySelector(".error").classList.remove("hidden");
|
|
85
137
|
}
|
|
86
138
|
}
|
|
87
139
|
);
|
|
88
140
|
});
|
|
89
141
|
});
|
|
90
|
-
|
|
91
142
|
</script>
|
|
92
143
|
</body>
|
|
93
144
|
</html>
|
package/dist/views/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/views/login.ts"],"names":[],"mappings":";;;AACA,mDAAmD;AACnD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAWjB,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,IAAA,sBAAW,EAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;;;;;;;;;;;;;;;;;;GAkBzE,CAAC;AACJ,CAAC,CAAC;AAnJW,QAAA,SAAS,aAmJpB"}
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"username-password.d.ts","sourceRoot":"","sources":["../../src/views/username-password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,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,GAAI,6GAWlC,oBAAoB,KAAG,MA+BzB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { QueryParams } from
|
|
1
|
+
import type { QueryParams } from "../types.ts";
|
|
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,
|
|
1
|
+
{"version":3,"file":"web-message.d.ts","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,UAAU,GAAI,uCAKxB,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC,KAAG,MA4DnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-message.js","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAGnB,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"web-message.js","sourceRoot":"","sources":["../../src/views/web-message.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAGnB,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,KAAK,GAC0D,EAAU,EAAE;IAC3E,IAAI,IAAI,GAAG,IAAA,eAAK,EACd;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;AAjEW,QAAA,UAAU,cAiErB"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simulacrum/auth0-simulator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Run local instance of Auth0 API for local development and integration testing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"bin": "bin/
|
|
6
|
+
"bin": "bin/start.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
8
|
+
"start": "node --import=tsx ./example/index.ts",
|
|
9
|
+
"start:bin": "node ./bin/start.js",
|
|
10
|
+
"test": "NODE_EXTRA_CA_CERTS=\"$(mkcert -CAROOT)/rootCA.pem\" vitest run --fileParallelism=false",
|
|
11
|
+
"test:watch": "NODE_EXTRA_CA_CERTS=\"$(mkcert -CAROOT)/rootCA.pem\" vitest watch --fileParallelism=false",
|
|
12
|
+
"prepack": "tsc --build tsconfig.dist.json && npm run copyAssets",
|
|
13
|
+
"copyAssets": "node -e \"require('fs').cpSync('./src/views/public/', './dist/views/public/', {recursive: true});\"",
|
|
11
14
|
"build": "npm run prepack",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"watch": "ts-node -P ./tsconfig.watch.json ./watch.ts"
|
|
15
|
+
"clean": "tsc --build --clean tsconfig.dist.json",
|
|
16
|
+
"lint": "echo noop"
|
|
15
17
|
},
|
|
16
18
|
"repository": {
|
|
17
19
|
"type": "git",
|
|
@@ -38,42 +40,25 @@
|
|
|
38
40
|
},
|
|
39
41
|
"homepage": "https://github.com/thefrontside/simulacrum#readme",
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"@types/faker": "^5.1.7",
|
|
45
|
-
"assert-ts": "^0.3.2",
|
|
43
|
+
"@simulacrum/foundation-simulator": "0.4.1",
|
|
44
|
+
"@faker-js/faker": "^9.3.0",
|
|
45
|
+
"assert-ts": "^0.3.4",
|
|
46
46
|
"base64-url": "^2.3.3",
|
|
47
|
-
"cookie-session": "^1.
|
|
48
|
-
"cosmiconfig": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"jsonwebtoken": "^8.5.1",
|
|
54
|
-
"zod": "^3.14.2"
|
|
47
|
+
"cookie-session": "^2.1.0",
|
|
48
|
+
"cosmiconfig": "^9.0.0",
|
|
49
|
+
"html-entities": "^2.5.2",
|
|
50
|
+
"jsesc": "^3.1.0",
|
|
51
|
+
"jsonwebtoken": "^9.0.2",
|
|
52
|
+
"zod": "^3.24.1"
|
|
55
53
|
},
|
|
56
54
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"@types/cookie-session": "^2.0.42",
|
|
65
|
-
"@types/dedent": "^0.7.0",
|
|
66
|
-
"@types/jsesc": "^2.5.1",
|
|
67
|
-
"@types/jsonwebtoken": "^8.5.1",
|
|
68
|
-
"@types/mocha": "^8.2.1",
|
|
69
|
-
"@types/ws": "^7.4.4",
|
|
70
|
-
"copy": "^0.3.2",
|
|
71
|
-
"expect": "^26.6.2",
|
|
72
|
-
"keygrip": "^1.1.0",
|
|
73
|
-
"mocha": "^8.0.0",
|
|
74
|
-
"rimraf": "^3.0.2",
|
|
75
|
-
"ts-node": "^10.9.1",
|
|
76
|
-
"ws": "^7.4.4"
|
|
55
|
+
"@types/base64-url": "^2.2.2",
|
|
56
|
+
"@types/cookie-session": "^2.0.49",
|
|
57
|
+
"@types/jsesc": "^3.0.3",
|
|
58
|
+
"@types/jsonwebtoken": "^9.0.9",
|
|
59
|
+
"tsx": "^4.19.4",
|
|
60
|
+
"typescript": "^5.8.3",
|
|
61
|
+
"vitest": "^1.6.0"
|
|
77
62
|
},
|
|
78
63
|
"volta": {
|
|
79
64
|
"extends": "../../package.json"
|