@absolutejs/auth 0.80.1 → 0.82.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/CHANGELOG.md +20 -0
- package/changelog.json +40 -0
- package/dist/credentials/api.d.ts +214 -0
- package/dist/credentials/emailVerification.d.ts +189 -1
- package/dist/credentials/integration.d.ts +3 -0
- package/dist/credentials/login.d.ts +208 -1
- package/dist/credentials/passwordReset.d.ts +197 -1
- package/dist/credentials/register.d.ts +198 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +76 -34
- package/dist/index.js.map +11 -10
- package/dist/manifest.js +57 -2
- package/dist/manifest.js.map +5 -4
- package/dist/manifest.json +25 -1
- package/dist/routes/signout.d.ts +192 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +76 -34
- package/dist/server.js.map +11 -10
- package/docs/PERSISTENT-CREDENTIALS.md +44 -1
- package/package.json +4 -3
package/dist/manifest.json
CHANGED
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
},
|
|
334
334
|
"wiring": [
|
|
335
335
|
{
|
|
336
|
-
"description": "Sign in with Google, GitHub, and 60+ other services.
|
|
336
|
+
"description": "Sign in with Google, GitHub, and 60+ other services. For email/password use get_credentials_integration and supply application-owned user, storage and email bindings.",
|
|
337
337
|
"id": "default",
|
|
338
338
|
"server": {
|
|
339
339
|
"code": ".use(\n\tawait auth({\n\t\t// TODO: return your application user for a session subject.\n\t\tgetUser: (sub) => ({ sub }),\n\t\tauthSessionStore: ${slot.sessionStore},\n\t\tcookieSecure: ${settings.cookieSecure},\n\t\tmaxSessions: ${settings.maxSessions},\n\t\tprovidersConfiguration: providersFromEnv(${settings.providersConfiguration} ?? {}),\n\t\tsessionDurationMs: ${settings.sessionDurationMs}\n\t})\n)",
|
|
@@ -352,6 +352,30 @@
|
|
|
352
352
|
}
|
|
353
353
|
],
|
|
354
354
|
"tools": {
|
|
355
|
+
"get_credentials_integration": {
|
|
356
|
+
"annotations": {
|
|
357
|
+
"readOnlyHint": true
|
|
358
|
+
},
|
|
359
|
+
"authorization": {
|
|
360
|
+
"approval": "never",
|
|
361
|
+
"audience": "admin",
|
|
362
|
+
"effects": [
|
|
363
|
+
"read"
|
|
364
|
+
],
|
|
365
|
+
"requiredScopes": [
|
|
366
|
+
"auth:inspect"
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
"capabilities": [
|
|
370
|
+
"read"
|
|
371
|
+
],
|
|
372
|
+
"description": "Get the package-owned typed email/password API and protected account route recipe. Reuse createCredentialsApi rather than inventing request wrappers. Requires application-owned user callbacks, a durable session and credential store, and real email delivery.",
|
|
373
|
+
"input": {
|
|
374
|
+
"type": "object",
|
|
375
|
+
"properties": {}
|
|
376
|
+
},
|
|
377
|
+
"kind": "workspace"
|
|
378
|
+
},
|
|
355
379
|
"list_sign_in_providers": {
|
|
356
380
|
"annotations": {
|
|
357
381
|
"readOnlyHint": true
|
package/dist/routes/signout.d.ts
CHANGED
|
@@ -5,7 +5,198 @@ type SignOutProps<UserType> = {
|
|
|
5
5
|
signoutRoute?: RouteString;
|
|
6
6
|
onSignOut: OnSignOut<UserType>;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
/** Fixed path for directly typed Eden clients; the same session revocation and
|
|
9
|
+
* cookie-clearing implementation as auth's configurable sign-out route. */
|
|
10
|
+
export declare const createSignoutApi: <UserType>(configuration: {
|
|
11
|
+
authSessionStore: AuthSessionStore<UserType>;
|
|
12
|
+
onSignOut?: OnSignOut<UserType>;
|
|
13
|
+
}) => import("elysia/types").AddRoute<"", "local", {
|
|
14
|
+
decorator: {};
|
|
15
|
+
store: {
|
|
16
|
+
session: SessionRecord<UserType>;
|
|
17
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
18
|
+
};
|
|
19
|
+
derive: {};
|
|
20
|
+
}, {
|
|
21
|
+
typebox: {};
|
|
22
|
+
error: [];
|
|
23
|
+
}, import("elysia/types").DefaultMetadata, {}, import("elysia/types").DefaultEphemeral, {
|
|
24
|
+
derive: {};
|
|
25
|
+
schema: {};
|
|
26
|
+
schemas: {};
|
|
27
|
+
response: {};
|
|
28
|
+
error: [];
|
|
29
|
+
}, "delete", "/oauth2/signout", import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
|
|
30
|
+
cookie: import("elysia").TCookieObject<{
|
|
31
|
+
auth_provider: import("typebox").TOptional<import("typebox").TString>;
|
|
32
|
+
user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
|
|
33
|
+
}>;
|
|
34
|
+
}, {}, "/oauth2/signout">, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, ({ status, store: { session }, cookie: { user_session_id, auth_provider } }: {
|
|
35
|
+
body: unknown;
|
|
36
|
+
query: Record<string, string | undefined>;
|
|
37
|
+
params: {};
|
|
38
|
+
headers: Record<string, string | undefined>;
|
|
39
|
+
cookie: Record<string, import("elysia").Cookie<unknown>> & {
|
|
40
|
+
user_session_id: import("elysia").Cookie<`${string}-${string}-${string}-${string}-${string}` | undefined>;
|
|
41
|
+
auth_provider: import("elysia").Cookie<string | undefined>;
|
|
42
|
+
};
|
|
43
|
+
server: import("elysia").Server | null;
|
|
44
|
+
redirect: import("elysia").redirect;
|
|
45
|
+
set: {
|
|
46
|
+
headers: import("elysia").HTTPHeaders;
|
|
47
|
+
status?: number | keyof import("elysia").StatusMap;
|
|
48
|
+
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
49
|
+
};
|
|
50
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
51
|
+
readonly 100: "Continue";
|
|
52
|
+
readonly 101: "Switching Protocols";
|
|
53
|
+
readonly 102: "Processing";
|
|
54
|
+
readonly 103: "Early Hints";
|
|
55
|
+
readonly 200: "OK";
|
|
56
|
+
readonly 201: "Created";
|
|
57
|
+
readonly 202: "Accepted";
|
|
58
|
+
readonly 203: "Non-Authoritative Information";
|
|
59
|
+
readonly 204: "No Content";
|
|
60
|
+
readonly 205: "Reset Content";
|
|
61
|
+
readonly 206: "Partial Content";
|
|
62
|
+
readonly 207: "Multi-Status";
|
|
63
|
+
readonly 208: "Already Reported";
|
|
64
|
+
readonly 300: "Multiple Choices";
|
|
65
|
+
readonly 301: "Moved Permanently";
|
|
66
|
+
readonly 302: "Found";
|
|
67
|
+
readonly 303: "See Other";
|
|
68
|
+
readonly 304: "Not Modified";
|
|
69
|
+
readonly 307: "Temporary Redirect";
|
|
70
|
+
readonly 308: "Permanent Redirect";
|
|
71
|
+
readonly 400: "Bad Request";
|
|
72
|
+
readonly 401: "Unauthorized";
|
|
73
|
+
readonly 402: "Payment Required";
|
|
74
|
+
readonly 403: "Forbidden";
|
|
75
|
+
readonly 404: "Not Found";
|
|
76
|
+
readonly 405: "Method Not Allowed";
|
|
77
|
+
readonly 406: "Not Acceptable";
|
|
78
|
+
readonly 407: "Proxy Authentication Required";
|
|
79
|
+
readonly 408: "Request Timeout";
|
|
80
|
+
readonly 409: "Conflict";
|
|
81
|
+
readonly 410: "Gone";
|
|
82
|
+
readonly 411: "Length Required";
|
|
83
|
+
readonly 412: "Precondition Failed";
|
|
84
|
+
readonly 413: "Payload Too Large";
|
|
85
|
+
readonly 414: "URI Too Long";
|
|
86
|
+
readonly 415: "Unsupported Media Type";
|
|
87
|
+
readonly 416: "Range Not Satisfiable";
|
|
88
|
+
readonly 417: "Expectation Failed";
|
|
89
|
+
readonly 418: "I'm a teapot";
|
|
90
|
+
readonly 420: "Enhance Your Calm";
|
|
91
|
+
readonly 421: "Misdirected Request";
|
|
92
|
+
readonly 422: "Unprocessable Content";
|
|
93
|
+
readonly 423: "Locked";
|
|
94
|
+
readonly 424: "Failed Dependency";
|
|
95
|
+
readonly 425: "Too Early";
|
|
96
|
+
readonly 426: "Upgrade Required";
|
|
97
|
+
readonly 428: "Precondition Required";
|
|
98
|
+
readonly 429: "Too Many Requests";
|
|
99
|
+
readonly 431: "Request Header Fields Too Large";
|
|
100
|
+
readonly 451: "Unavailable For Legal Reasons";
|
|
101
|
+
readonly 500: "Internal Server Error";
|
|
102
|
+
readonly 501: "Not Implemented";
|
|
103
|
+
readonly 502: "Bad Gateway";
|
|
104
|
+
readonly 503: "Service Unavailable";
|
|
105
|
+
readonly 504: "Gateway Timeout";
|
|
106
|
+
readonly 505: "HTTP Version Not Supported";
|
|
107
|
+
readonly 506: "Variant Also Negotiates";
|
|
108
|
+
readonly 507: "Insufficient Storage";
|
|
109
|
+
readonly 508: "Loop Detected";
|
|
110
|
+
readonly 510: "Not Extended";
|
|
111
|
+
readonly 511: "Network Authentication Required";
|
|
112
|
+
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
113
|
+
readonly Continue: 100;
|
|
114
|
+
readonly "Switching Protocols": 101;
|
|
115
|
+
readonly Processing: 102;
|
|
116
|
+
readonly "Early Hints": 103;
|
|
117
|
+
readonly OK: 200;
|
|
118
|
+
readonly Created: 201;
|
|
119
|
+
readonly Accepted: 202;
|
|
120
|
+
readonly "Non-Authoritative Information": 203;
|
|
121
|
+
readonly "No Content": 204;
|
|
122
|
+
readonly "Reset Content": 205;
|
|
123
|
+
readonly "Partial Content": 206;
|
|
124
|
+
readonly "Multi-Status": 207;
|
|
125
|
+
readonly "Already Reported": 208;
|
|
126
|
+
readonly "Multiple Choices": 300;
|
|
127
|
+
readonly "Moved Permanently": 301;
|
|
128
|
+
readonly Found: 302;
|
|
129
|
+
readonly "See Other": 303;
|
|
130
|
+
readonly "Not Modified": 304;
|
|
131
|
+
readonly "Temporary Redirect": 307;
|
|
132
|
+
readonly "Permanent Redirect": 308;
|
|
133
|
+
readonly "Bad Request": 400;
|
|
134
|
+
readonly Unauthorized: 401;
|
|
135
|
+
readonly "Payment Required": 402;
|
|
136
|
+
readonly Forbidden: 403;
|
|
137
|
+
readonly "Not Found": 404;
|
|
138
|
+
readonly "Method Not Allowed": 405;
|
|
139
|
+
readonly "Not Acceptable": 406;
|
|
140
|
+
readonly "Proxy Authentication Required": 407;
|
|
141
|
+
readonly "Request Timeout": 408;
|
|
142
|
+
readonly Conflict: 409;
|
|
143
|
+
readonly Gone: 410;
|
|
144
|
+
readonly "Length Required": 411;
|
|
145
|
+
readonly "Precondition Failed": 412;
|
|
146
|
+
readonly "Payload Too Large": 413;
|
|
147
|
+
readonly "URI Too Long": 414;
|
|
148
|
+
readonly "Unsupported Media Type": 415;
|
|
149
|
+
readonly "Range Not Satisfiable": 416;
|
|
150
|
+
readonly "Expectation Failed": 417;
|
|
151
|
+
readonly "I'm a teapot": 418;
|
|
152
|
+
readonly "Enhance Your Calm": 420;
|
|
153
|
+
readonly "Misdirected Request": 421;
|
|
154
|
+
readonly "Unprocessable Content": 422;
|
|
155
|
+
readonly Locked: 423;
|
|
156
|
+
readonly "Failed Dependency": 424;
|
|
157
|
+
readonly "Too Early": 425;
|
|
158
|
+
readonly "Upgrade Required": 426;
|
|
159
|
+
readonly "Precondition Required": 428;
|
|
160
|
+
readonly "Too Many Requests": 429;
|
|
161
|
+
readonly "Request Header Fields Too Large": 431;
|
|
162
|
+
readonly "Unavailable For Legal Reasons": 451;
|
|
163
|
+
readonly "Internal Server Error": 500;
|
|
164
|
+
readonly "Not Implemented": 501;
|
|
165
|
+
readonly "Bad Gateway": 502;
|
|
166
|
+
readonly "Service Unavailable": 503;
|
|
167
|
+
readonly "Gateway Timeout": 504;
|
|
168
|
+
readonly "HTTP Version Not Supported": 505;
|
|
169
|
+
readonly "Variant Also Negotiates": 506;
|
|
170
|
+
readonly "Insufficient Storage": 507;
|
|
171
|
+
readonly "Loop Detected": 508;
|
|
172
|
+
readonly "Not Extended": 510;
|
|
173
|
+
readonly "Network Authentication Required": 511;
|
|
174
|
+
}[Code] : Code>;
|
|
175
|
+
defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
|
|
176
|
+
cookie: import("elysia").TCookieObject<{
|
|
177
|
+
auth_provider: import("typebox").TOptional<import("typebox").TString>;
|
|
178
|
+
user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
|
|
179
|
+
}>;
|
|
180
|
+
}, {}, "/oauth2/signout">, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>>, NoInfer<{
|
|
181
|
+
decorator: {};
|
|
182
|
+
store: {
|
|
183
|
+
session: SessionRecord<UserType>;
|
|
184
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
185
|
+
};
|
|
186
|
+
derive: {};
|
|
187
|
+
} & {
|
|
188
|
+
derive: {};
|
|
189
|
+
}>>) => import("elysia/types").MaybePromise<void>;
|
|
190
|
+
readonly path: string;
|
|
191
|
+
route?: string | undefined;
|
|
192
|
+
rid?: string | undefined;
|
|
193
|
+
request: Request;
|
|
194
|
+
store: {
|
|
195
|
+
session: SessionRecord<UserType>;
|
|
196
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
197
|
+
};
|
|
198
|
+
}) => Promise<Response | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "No user session id found", 401> | import("elysia").ElysiaStatus<"Internal Server Error", "Sign out operation failed", 500>>>;
|
|
199
|
+
export declare const signout: <UserType>(configuration: SignOutProps<UserType>) => import("elysia/types").AddRoute<"", "local", {
|
|
9
200
|
decorator: {};
|
|
10
201
|
store: {
|
|
11
202
|
session: SessionRecord<UserType>;
|
package/dist/server.d.ts
CHANGED
|
@@ -34,3 +34,5 @@ export type { AuthConfig, OAuth2ConfigurationOptions, SessionData, UnregisteredS
|
|
|
34
34
|
export { instantiateUserSession } from './utils';
|
|
35
35
|
export type { OAuth2TokenResponse, ProviderOption } from 'citra';
|
|
36
36
|
export { extractPropFromIdentity, isValidProviderOption, providers } from 'citra';
|
|
37
|
+
export { createCredentialsApi } from './credentials/api';
|
|
38
|
+
export { createSignoutApi } from './routes/signout';
|
package/dist/server.js
CHANGED
|
@@ -4015,7 +4015,7 @@ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Clien
|
|
|
4015
4015
|
var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
|
|
4016
4016
|
|
|
4017
4017
|
// src/index.ts
|
|
4018
|
-
import { Elysia as
|
|
4018
|
+
import { Elysia as Elysia49 } from "elysia";
|
|
4019
4019
|
|
|
4020
4020
|
// src/apikeys/routes.ts
|
|
4021
4021
|
import { Elysia, t } from "elysia";
|
|
@@ -6858,7 +6858,11 @@ var DEFAULT_RESET_TOKEN_TTL_MS = MILLISECONDS_IN_AN_HOUR;
|
|
|
6858
6858
|
var DEFAULT_VERIFICATION_TOKEN_TTL_MS = MILLISECONDS_IN_A_DAY;
|
|
6859
6859
|
|
|
6860
6860
|
// src/credentials/emailVerification.ts
|
|
6861
|
-
var credentialsEmailVerification = ({
|
|
6861
|
+
var credentialsEmailVerification = (configuration) => credentialsEmailVerificationRoute({
|
|
6862
|
+
...configuration,
|
|
6863
|
+
verifyEmailRoute: configuration.verifyEmailRoute ?? "/auth/verify-email"
|
|
6864
|
+
});
|
|
6865
|
+
var credentialsEmailVerificationRoute = ({
|
|
6862
6866
|
credentialStore,
|
|
6863
6867
|
getUserByEmail,
|
|
6864
6868
|
onCreateCredentialUser,
|
|
@@ -6867,7 +6871,7 @@ var credentialsEmailVerification = ({
|
|
|
6867
6871
|
onSendEmail,
|
|
6868
6872
|
requireEmailVerification = false,
|
|
6869
6873
|
verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS,
|
|
6870
|
-
verifyEmailRoute
|
|
6874
|
+
verifyEmailRoute
|
|
6871
6875
|
}) => new Elysia10().post(verifyEmailRoute, { body: t7.Object({ token: t7.String() }) }, async ({ body: { token }, status }) => {
|
|
6872
6876
|
const consumed = await credentialStore.consumeVerificationToken(await hashToken(token));
|
|
6873
6877
|
if (!consumed) {
|
|
@@ -7147,7 +7151,11 @@ var isPasswordCompromised = (password) => isPasswordBreached(password);
|
|
|
7147
7151
|
// src/credentials/login.ts
|
|
7148
7152
|
var dummyPasswordHashPromise;
|
|
7149
7153
|
var dummyPasswordHash = () => dummyPasswordHashPromise ??= hashPassword("absolutejs-auth-timing-equalizer");
|
|
7150
|
-
var credentialsLogin = ({
|
|
7154
|
+
var credentialsLogin = (configuration) => credentialsLoginRoute({
|
|
7155
|
+
...configuration,
|
|
7156
|
+
loginRoute: configuration.loginRoute ?? "/auth/login"
|
|
7157
|
+
});
|
|
7158
|
+
var credentialsLoginRoute = ({
|
|
7151
7159
|
authSessionStore,
|
|
7152
7160
|
checkBreachesOnLogin,
|
|
7153
7161
|
cookieSecure,
|
|
@@ -7156,7 +7164,7 @@ var credentialsLogin = ({
|
|
|
7156
7164
|
getUserByEmail,
|
|
7157
7165
|
isMfaRequired,
|
|
7158
7166
|
lockoutGuard,
|
|
7159
|
-
loginRoute
|
|
7167
|
+
loginRoute,
|
|
7160
7168
|
onCredentialsLoginError,
|
|
7161
7169
|
onCredentialsLoginSuccess,
|
|
7162
7170
|
onUntrustedOrigin,
|
|
@@ -7269,12 +7277,16 @@ var credentialsLogin = ({
|
|
|
7269
7277
|
// src/credentials/passwordReset.ts
|
|
7270
7278
|
init_crypto();
|
|
7271
7279
|
import { Elysia as Elysia12, t as t9 } from "elysia";
|
|
7272
|
-
var credentialsPasswordReset = ({
|
|
7280
|
+
var credentialsPasswordReset = (configuration) => credentialsPasswordResetRoute({
|
|
7281
|
+
...configuration,
|
|
7282
|
+
resetPasswordRoute: configuration.resetPasswordRoute ?? "/auth/reset-password"
|
|
7283
|
+
});
|
|
7284
|
+
var credentialsPasswordResetRoute = ({
|
|
7273
7285
|
credentialStore,
|
|
7274
7286
|
onPasswordReset,
|
|
7275
7287
|
onSendEmail,
|
|
7276
7288
|
passwordPolicy,
|
|
7277
|
-
resetPasswordRoute
|
|
7289
|
+
resetPasswordRoute,
|
|
7278
7290
|
resetTokenDurationMs = DEFAULT_RESET_TOKEN_TTL_MS
|
|
7279
7291
|
}) => new Elysia12().post(`${resetPasswordRoute}/request`, { body: t9.Object({ email: t9.String() }) }, async ({ body: { email }, status }) => {
|
|
7280
7292
|
const normalizedEmail = email.trim().toLowerCase();
|
|
@@ -7331,7 +7343,11 @@ var credentialsPasswordReset = ({
|
|
|
7331
7343
|
// src/credentials/register.ts
|
|
7332
7344
|
init_crypto();
|
|
7333
7345
|
import { Elysia as Elysia13, t as t10 } from "elysia";
|
|
7334
|
-
var credentialsRegister = ({
|
|
7346
|
+
var credentialsRegister = (configuration) => credentialsRegisterRoute({
|
|
7347
|
+
...configuration,
|
|
7348
|
+
registerRoute: configuration.registerRoute ?? "/auth/register"
|
|
7349
|
+
});
|
|
7350
|
+
var credentialsRegisterRoute = ({
|
|
7335
7351
|
authSessionStore,
|
|
7336
7352
|
cookieSecure,
|
|
7337
7353
|
credentialStore,
|
|
@@ -7344,7 +7360,7 @@ var credentialsRegister = ({
|
|
|
7344
7360
|
onSendEmail,
|
|
7345
7361
|
onUntrustedOrigin,
|
|
7346
7362
|
passwordPolicy,
|
|
7347
|
-
registerRoute
|
|
7363
|
+
registerRoute,
|
|
7348
7364
|
requireEmailVerification = false,
|
|
7349
7365
|
revealRegistrationConflicts = false,
|
|
7350
7366
|
sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
|
|
@@ -12850,9 +12866,18 @@ var runSignOut = async (onSignOut, args) => {
|
|
|
12850
12866
|
return false;
|
|
12851
12867
|
}
|
|
12852
12868
|
};
|
|
12853
|
-
var
|
|
12869
|
+
var createSignoutApi = (configuration) => createSignoutRoute({
|
|
12870
|
+
...configuration,
|
|
12871
|
+
onSignOut: configuration.onSignOut,
|
|
12872
|
+
signoutRoute: "/oauth2/signout"
|
|
12873
|
+
});
|
|
12874
|
+
var signout = (configuration) => createSignoutRoute({
|
|
12875
|
+
...configuration,
|
|
12876
|
+
signoutRoute: configuration.signoutRoute ?? "/oauth2/signout"
|
|
12877
|
+
});
|
|
12878
|
+
var createSignoutRoute = ({
|
|
12854
12879
|
authSessionStore,
|
|
12855
|
-
signoutRoute
|
|
12880
|
+
signoutRoute,
|
|
12856
12881
|
onSignOut
|
|
12857
12882
|
}) => new Elysia35().use(sessionStore()).delete(signoutRoute, {
|
|
12858
12883
|
cookie: t28.Cookie({
|
|
@@ -41561,6 +41586,21 @@ var createInMemorySetupSessionStore = () => {
|
|
|
41561
41586
|
}
|
|
41562
41587
|
};
|
|
41563
41588
|
};
|
|
41589
|
+
// src/credentials/api.ts
|
|
41590
|
+
import { Elysia as Elysia48 } from "elysia";
|
|
41591
|
+
var createCredentialsApi = (configuration) => new Elysia48().use(credentialsRegisterRoute({
|
|
41592
|
+
...configuration,
|
|
41593
|
+
registerRoute: "/auth/register"
|
|
41594
|
+
})).use(credentialsLoginRoute({
|
|
41595
|
+
...configuration,
|
|
41596
|
+
loginRoute: "/auth/login"
|
|
41597
|
+
})).use(credentialsEmailVerificationRoute({
|
|
41598
|
+
...configuration,
|
|
41599
|
+
verifyEmailRoute: "/auth/verify-email"
|
|
41600
|
+
})).use(credentialsPasswordResetRoute({
|
|
41601
|
+
...configuration,
|
|
41602
|
+
resetPasswordRoute: "/auth/reset-password"
|
|
41603
|
+
}));
|
|
41564
41604
|
|
|
41565
41605
|
// src/index.ts
|
|
41566
41606
|
var validatePositiveOptions = (prefix, options) => {
|
|
@@ -41794,7 +41834,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41794
41834
|
const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
|
|
41795
41835
|
const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
|
|
41796
41836
|
const pluginSeed = pluginDependencySeed(configuration);
|
|
41797
|
-
const coreRoutes = new
|
|
41837
|
+
const coreRoutes = new Elysia49({
|
|
41798
41838
|
name: "@absolutejs/auth/core-routes",
|
|
41799
41839
|
seed: pluginSeed
|
|
41800
41840
|
}).use([
|
|
@@ -41851,62 +41891,62 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41851
41891
|
profileRoute
|
|
41852
41892
|
})
|
|
41853
41893
|
]);
|
|
41854
|
-
const identityFeatureRoutes = new
|
|
41894
|
+
const identityFeatureRoutes = new Elysia49().use([
|
|
41855
41895
|
auditedCredentials ? credentialRoutes({
|
|
41856
41896
|
...auditedCredentials,
|
|
41857
41897
|
authSessionStore,
|
|
41858
41898
|
cookieSecure: resolvedCookieSecure,
|
|
41859
41899
|
lockoutGuard
|
|
41860
|
-
}) : new
|
|
41900
|
+
}) : new Elysia49,
|
|
41861
41901
|
auditedMfa ? mfaRoutes({
|
|
41862
41902
|
...auditedMfa,
|
|
41863
41903
|
authSessionStore,
|
|
41864
41904
|
cookieSecure: resolvedCookieSecure,
|
|
41865
41905
|
verificationProvider
|
|
41866
|
-
}) : new
|
|
41906
|
+
}) : new Elysia49,
|
|
41867
41907
|
passwordless ? passwordlessRoutes({
|
|
41868
41908
|
...passwordless,
|
|
41869
41909
|
authSessionStore,
|
|
41870
41910
|
cookieSecure: resolvedCookieSecure,
|
|
41871
41911
|
emit: auditEmit
|
|
41872
|
-
}) : new
|
|
41873
|
-
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new
|
|
41912
|
+
}) : new Elysia49,
|
|
41913
|
+
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia49,
|
|
41874
41914
|
sso ? oidcSsoRoutes({
|
|
41875
41915
|
...sso,
|
|
41876
41916
|
authSessionStore,
|
|
41877
41917
|
cookieSecure: resolvedCookieSecure
|
|
41878
|
-
}) : new
|
|
41918
|
+
}) : new Elysia49,
|
|
41879
41919
|
sso && sso.samlAdapter ? samlSsoRoutes({
|
|
41880
41920
|
...sso,
|
|
41881
41921
|
authSessionStore,
|
|
41882
41922
|
cookieSecure: resolvedCookieSecure,
|
|
41883
41923
|
samlAdapter: sso.samlAdapter
|
|
41884
|
-
}) : new
|
|
41924
|
+
}) : new Elysia49
|
|
41885
41925
|
]);
|
|
41886
|
-
const organizationFeatureRoutes = new
|
|
41926
|
+
const organizationFeatureRoutes = new Elysia49().use([
|
|
41887
41927
|
sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
|
|
41888
41928
|
getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
|
|
41889
41929
|
ssoConnectionStore: sso.ssoConnectionStore,
|
|
41890
41930
|
ssoRoute: sso.ssoRoute
|
|
41891
|
-
}) : new
|
|
41892
|
-
scim ? scimRoutes(scim) : new
|
|
41893
|
-
apikeys ? apiKeysRoutes(apikeys) : new
|
|
41931
|
+
}) : new Elysia49,
|
|
41932
|
+
scim ? scimRoutes(scim) : new Elysia49,
|
|
41933
|
+
apikeys ? apiKeysRoutes(apikeys) : new Elysia49,
|
|
41894
41934
|
oidcConfig ? oidcProviderRoutes({
|
|
41895
41935
|
...oidcConfig,
|
|
41896
41936
|
authSessionStore
|
|
41897
|
-
}) : new
|
|
41937
|
+
}) : new Elysia49,
|
|
41898
41938
|
organizations ? organizationRoutes({
|
|
41899
41939
|
...organizations,
|
|
41900
41940
|
authSessionStore,
|
|
41901
41941
|
emit: auditEmit
|
|
41902
|
-
}) : new
|
|
41942
|
+
}) : new Elysia49,
|
|
41903
41943
|
roles ? roleRoutes({
|
|
41904
41944
|
...roles,
|
|
41905
41945
|
authSessionStore,
|
|
41906
41946
|
emit: auditEmit
|
|
41907
|
-
}) : new
|
|
41947
|
+
}) : new Elysia49
|
|
41908
41948
|
]);
|
|
41909
|
-
const pushApplication = new
|
|
41949
|
+
const pushApplication = new Elysia49;
|
|
41910
41950
|
if (pushConfig && oidcConfig)
|
|
41911
41951
|
pushApplication.use(pushRoutes({
|
|
41912
41952
|
accessTokens: {
|
|
@@ -41916,24 +41956,24 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41916
41956
|
authSessionStore,
|
|
41917
41957
|
config: pushConfig
|
|
41918
41958
|
}));
|
|
41919
|
-
const extendedFeatureRoutes = new
|
|
41959
|
+
const extendedFeatureRoutes = new Elysia49().use([
|
|
41920
41960
|
pushApplication,
|
|
41921
|
-
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new
|
|
41961
|
+
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia49,
|
|
41922
41962
|
webauthn ? webauthnRoutes({
|
|
41923
41963
|
...webauthn,
|
|
41924
41964
|
authSessionStore,
|
|
41925
41965
|
cookieSecure: resolvedCookieSecure,
|
|
41926
41966
|
emit: auditEmit
|
|
41927
|
-
}) : new
|
|
41967
|
+
}) : new Elysia49,
|
|
41928
41968
|
compliance ? complianceRoutes({
|
|
41929
41969
|
...compliance,
|
|
41930
41970
|
authSessionStore,
|
|
41931
41971
|
emit: auditEmit
|
|
41932
|
-
}) : new
|
|
41972
|
+
}) : new Elysia49,
|
|
41933
41973
|
createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
|
|
41934
41974
|
agentAuthRoutes(resolvedAgentAuth)
|
|
41935
41975
|
]);
|
|
41936
|
-
const featureRoutes = new
|
|
41976
|
+
const featureRoutes = new Elysia49({
|
|
41937
41977
|
name: "@absolutejs/auth/feature-routes",
|
|
41938
41978
|
seed: pluginSeed
|
|
41939
41979
|
}).use([
|
|
@@ -41956,7 +41996,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41956
41996
|
};
|
|
41957
41997
|
var auth = async (configuration) => {
|
|
41958
41998
|
const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
|
|
41959
|
-
const application = new
|
|
41999
|
+
const application = new Elysia49({
|
|
41960
42000
|
name: "@absolutejs/auth",
|
|
41961
42001
|
seed: pluginDependencySeed(configuration)
|
|
41962
42002
|
});
|
|
@@ -42127,11 +42167,13 @@ export {
|
|
|
42127
42167
|
auth2 as auth,
|
|
42128
42168
|
createAbsoluteAuthSyncBridge,
|
|
42129
42169
|
createAuthContext,
|
|
42170
|
+
createCredentialsApi,
|
|
42130
42171
|
createNodeSamlAdapter,
|
|
42131
42172
|
createPostgresScimTokenStore,
|
|
42132
42173
|
createPostgresSetupSessionStore,
|
|
42133
42174
|
createPostgresSsoConnectionStore,
|
|
42134
42175
|
createSetupSession,
|
|
42176
|
+
createSignoutApi,
|
|
42135
42177
|
deriveAuthSyncNamespace,
|
|
42136
42178
|
extractPropFromIdentity,
|
|
42137
42179
|
instantiateUserSession,
|
|
@@ -42144,5 +42186,5 @@ export {
|
|
|
42144
42186
|
userSessionIdTypebox
|
|
42145
42187
|
};
|
|
42146
42188
|
|
|
42147
|
-
//# debugId=
|
|
42189
|
+
//# debugId=B801BF9A602847F164756E2164756E21
|
|
42148
42190
|
//# sourceMappingURL=server.js.map
|