@absolutejs/auth 0.55.5 → 0.55.7
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 +6 -1
- package/dist/agents/index.js +36 -6
- package/dist/agents/index.js.map +6 -5
- package/dist/index.d.ts +3400 -8
- package/dist/index.js +777 -522
- package/dist/index.js.map +17 -13
- package/dist/server.d.ts +6 -6
- package/dist/server.js +775 -522
- package/dist/server.js.map +18 -14
- package/package.json +1 -1
- package/dist/abuse/captcha.d.ts +0 -11
- package/dist/abuse/config.d.ts +0 -29
- package/dist/actions.d.ts +0 -27
- package/dist/adaptive/config.d.ts +0 -34
- package/dist/adaptive/fingerprint.d.ts +0 -2
- package/dist/adaptive/inMemoryStores.d.ts +0 -3
- package/dist/adaptive/postgresStores.d.ts +0 -245
- package/dist/adaptive/types.d.ts +0 -62
- package/dist/agents/config.d.ts +0 -44
- package/dist/agents/context.d.ts +0 -46
- package/dist/agents/idJag.d.ts +0 -49
- package/dist/agents/inMemoryStores.d.ts +0 -4
- package/dist/agents/oidcAdapter.d.ts +0 -12
- package/dist/agents/postgresStores.d.ts +0 -569
- package/dist/agents/principal.d.ts +0 -4
- package/dist/agents/registration.d.ts +0 -162
- package/dist/agents/registrationClient.d.ts +0 -50
- package/dist/agents/routes.d.ts +0 -214
- package/dist/agents/types.d.ts +0 -129
- package/dist/apikeys/config.d.ts +0 -64
- package/dist/apikeys/inMemoryStores.d.ts +0 -4
- package/dist/apikeys/postgresStores.d.ts +0 -359
- package/dist/apikeys/routes.d.ts +0 -83
- package/dist/apikeys/types.d.ts +0 -53
- package/dist/audit/config.d.ts +0 -9
- package/dist/audit/export.d.ts +0 -2
- package/dist/audit/inMemoryAuditStore.d.ts +0 -2
- package/dist/audit/integrity.d.ts +0 -19
- package/dist/audit/postgresAuditStore.d.ts +0 -116
- package/dist/audit/siem.d.ts +0 -11
- package/dist/audit/types.d.ts +0 -19
- package/dist/audit/wrap.d.ts +0 -9
- package/dist/authInstance.d.ts +0 -7
- package/dist/authorization/config.d.ts +0 -19
- package/dist/authorization/protectPermission.d.ts +0 -52
- package/dist/compliance/cipher.d.ts +0 -5
- package/dist/compliance/config.d.ts +0 -18
- package/dist/compliance/redaction.d.ts +0 -8
- package/dist/compliance/routes.d.ts +0 -89
- package/dist/constants.d.ts +0 -10
- package/dist/credentials/backgroundOps.d.ts +0 -45
- package/dist/credentials/config.d.ts +0 -68
- package/dist/credentials/emailValidation.d.ts +0 -9
- package/dist/credentials/emailVerification.d.ts +0 -83
- package/dist/credentials/import.d.ts +0 -34
- package/dist/credentials/inMemoryCredentialStore.d.ts +0 -2
- package/dist/credentials/legacyHashers.d.ts +0 -3
- package/dist/credentials/login.d.ts +0 -76
- package/dist/credentials/passwordPolicy.d.ts +0 -15
- package/dist/credentials/passwordReset.d.ts +0 -87
- package/dist/credentials/postgresCredentialStore.d.ts +0 -235
- package/dist/credentials/register.d.ts +0 -54
- package/dist/credentials/routes.d.ts +0 -201
- package/dist/credentials/types.d.ts +0 -26
- package/dist/crypto.d.ts +0 -32
- package/dist/errors.d.ts +0 -12
- package/dist/federation/tokenStore.d.ts +0 -29
- package/dist/fga/config.d.ts +0 -53
- package/dist/fga/inMemoryStores.d.ts +0 -3
- package/dist/fga/postgresStores.d.ts +0 -116
- package/dist/fga/redisCheckCache.d.ts +0 -11
- package/dist/fga/schema.d.ts +0 -2
- package/dist/fga/types.d.ts +0 -28
- package/dist/htmx/renderers.d.ts +0 -8
- package/dist/htmx/routes.d.ts +0 -514
- package/dist/htmx/types.d.ts +0 -129
- package/dist/linkedProviders/inMemoryStores.d.ts +0 -9
- package/dist/linkedProviders/neonStores.d.ts +0 -484
- package/dist/linkedProviders/oauthResolver.d.ts +0 -9
- package/dist/linkedProviders/resolver.d.ts +0 -22
- package/dist/lockout/config.d.ts +0 -17
- package/dist/lockout/inMemoryLockoutStore.d.ts +0 -2
- package/dist/lockout/postgresLockoutStore.d.ts +0 -71
- package/dist/lockout/redisLockoutStore.d.ts +0 -3
- package/dist/lockout/types.d.ts +0 -12
- package/dist/mfa/backupCodes.d.ts +0 -5
- package/dist/mfa/challenge.d.ts +0 -70
- package/dist/mfa/config.d.ts +0 -50
- package/dist/mfa/gate.d.ts +0 -2
- package/dist/mfa/inMemoryMfaStore.d.ts +0 -2
- package/dist/mfa/management.d.ts +0 -106
- package/dist/mfa/postgresMfaStore.d.ts +0 -206
- package/dist/mfa/rotation.d.ts +0 -17
- package/dist/mfa/routes.d.ts +0 -234
- package/dist/mfa/secret.d.ts +0 -2
- package/dist/mfa/sms.d.ts +0 -105
- package/dist/mfa/totp.d.ts +0 -91
- package/dist/mfa/types.d.ts +0 -23
- package/dist/migrations/generate.d.ts +0 -2
- package/dist/migrations/index.d.ts +0 -5
- package/dist/migrations/runner.d.ts +0 -13
- package/dist/migrations/types.d.ts +0 -14
- package/dist/oidc/clientAuth.d.ts +0 -19
- package/dist/oidc/clientIdMetadata.d.ts +0 -32
- package/dist/oidc/config.d.ts +0 -295
- package/dist/oidc/dpop.d.ts +0 -23
- package/dist/oidc/inMemoryStores.d.ts +0 -11
- package/dist/oidc/inMemoryVciStores.d.ts +0 -3
- package/dist/oidc/jar.d.ts +0 -14
- package/dist/oidc/keys.d.ts +0 -25
- package/dist/oidc/logout.d.ts +0 -38
- package/dist/oidc/mtls.d.ts +0 -11
- package/dist/oidc/par.d.ts +0 -28
- package/dist/oidc/postgresStores.d.ts +0 -1187
- package/dist/oidc/registration.d.ts +0 -138
- package/dist/oidc/routes.d.ts +0 -568
- package/dist/oidc/types.d.ts +0 -143
- package/dist/oidc/userinfo.d.ts +0 -21
- package/dist/oidc/vci.d.ts +0 -159
- package/dist/oidc/vciRoutes.d.ts +0 -92
- package/dist/organizations/config.d.ts +0 -46
- package/dist/organizations/inMemoryOrganizationStore.d.ts +0 -2
- package/dist/organizations/operations.d.ts +0 -39
- package/dist/organizations/postgresOrganizationStore.d.ts +0 -340
- package/dist/organizations/routes.d.ts +0 -298
- package/dist/organizations/types.d.ts +0 -45
- package/dist/passwordless/config.d.ts +0 -43
- package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +0 -2
- package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +0 -56
- package/dist/passwordless/routes.d.ts +0 -162
- package/dist/passwordless/types.d.ts +0 -9
- package/dist/portal/config.d.ts +0 -34
- package/dist/portal/inMemorySetupSessionStore.d.ts +0 -2
- package/dist/portal/operations.d.ts +0 -10
- package/dist/portal/postgresSetupSessionStore.d.ts +0 -116
- package/dist/portal/routes.d.ts +0 -160
- package/dist/portal/types.d.ts +0 -16
- package/dist/providers/clients.d.ts +0 -1818
- package/dist/providersFromEnv.d.ts +0 -19
- package/dist/roles/config.d.ts +0 -27
- package/dist/roles/inMemoryRoleStore.d.ts +0 -2
- package/dist/roles/operations.d.ts +0 -8
- package/dist/roles/postgresRoleStore.d.ts +0 -86
- package/dist/roles/resolver.d.ts +0 -17
- package/dist/roles/routes.d.ts +0 -105
- package/dist/roles/types.d.ts +0 -14
- package/dist/routes/authorize.d.ts +0 -102
- package/dist/routes/callback.d.ts +0 -64
- package/dist/routes/profile.d.ts +0 -70
- package/dist/routes/protectRoute.d.ts +0 -51
- package/dist/routes/refresh.d.ts +0 -74
- package/dist/routes/revoke.d.ts +0 -73
- package/dist/routes/sessions.d.ts +0 -103
- package/dist/routes/signout.d.ts +0 -70
- package/dist/routes/stepUp.d.ts +0 -48
- package/dist/routes/userStatus.d.ts +0 -72
- package/dist/scim/config.d.ts +0 -57
- package/dist/scim/extensions.d.ts +0 -30
- package/dist/scim/inMemoryScimTokenStore.d.ts +0 -2
- package/dist/scim/postgresScimTokenStore.d.ts +0 -86
- package/dist/scim/routes.d.ts +0 -366
- package/dist/scim/serialize.d.ts +0 -83
- package/dist/scim/types.d.ts +0 -54
- package/dist/serverConfig.d.ts +0 -10
- package/dist/session/access.d.ts +0 -33
- package/dist/session/anonymous.d.ts +0 -12
- package/dist/session/cleanup.d.ts +0 -45
- package/dist/session/impersonation.d.ts +0 -34
- package/dist/session/inMemoryStore.d.ts +0 -7
- package/dist/session/internalData.d.ts +0 -34
- package/dist/session/multiSession.d.ts +0 -27
- package/dist/session/neonStore.d.ts +0 -513
- package/dist/session/promote.d.ts +0 -23
- package/dist/session/redisStore.d.ts +0 -6
- package/dist/session/sessionsConfig.d.ts +0 -9
- package/dist/session/state.d.ts +0 -33
- package/dist/session/types.d.ts +0 -20
- package/dist/session/userSessions.d.ts +0 -19
- package/dist/sso/config.d.ts +0 -149
- package/dist/sso/discoveryRoute.d.ts +0 -63
- package/dist/sso/inMemorySamlServiceProviderStore.d.ts +0 -2
- package/dist/sso/inMemorySsoConnectionStore.d.ts +0 -2
- package/dist/sso/oidcRoutes.d.ts +0 -98
- package/dist/sso/postgresSamlServiceProviderStore.d.ts +0 -101
- package/dist/sso/postgresSsoConnectionStore.d.ts +0 -116
- package/dist/sso/samlIdpRoutes.d.ts +0 -139
- package/dist/sso/samlRoutes.d.ts +0 -178
- package/dist/sso/types.d.ts +0 -53
- package/dist/stores/postgres.d.ts +0 -5
- package/dist/stores/redis.d.ts +0 -5
- package/dist/telemetry/tracing.d.ts +0 -15
- package/dist/tenancy.d.ts +0 -9
- package/dist/typeGuards.d.ts +0 -6
- package/dist/typebox.d.ts +0 -4
- package/dist/types.d.ts +0 -421
- package/dist/utils.d.ts +0 -45
- package/dist/vault/config.d.ts +0 -20
- package/dist/vault/inMemoryVaultStore.d.ts +0 -2
- package/dist/vault/postgresVaultStore.d.ts +0 -86
- package/dist/vault/types.d.ts +0 -14
- package/dist/vc/inMemoryVpStores.d.ts +0 -2
- package/dist/vc/openid4vp.d.ts +0 -82
- package/dist/vc/postgresVcStores.d.ts +0 -300
- package/dist/vc/sdJwt.d.ts +0 -37
- package/dist/vc/statusList.d.ts +0 -29
- package/dist/vc/statusListRoutes.d.ts +0 -63
- package/dist/vc/vpRoutes.d.ts +0 -120
- package/dist/webauthn/adapter.d.ts +0 -59
- package/dist/webauthn/config.d.ts +0 -36
- package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +0 -2
- package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +0 -146
- package/dist/webauthn/routes.d.ts +0 -155
- package/dist/webauthn/types.d.ts +0 -17
- package/dist/webhooks/config.d.ts +0 -34
- package/dist/webhooks/dispatcher.d.ts +0 -3
- package/dist/webhooks/inMemoryStore.d.ts +0 -2
- package/dist/webhooks/postgresStore.d.ts +0 -116
- package/dist/webhooks/sign.d.ts +0 -11
- package/dist/webhooks/types.d.ts +0 -25
package/dist/server.js
CHANGED
|
@@ -2824,7 +2824,7 @@ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Clien
|
|
|
2824
2824
|
var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
|
|
2825
2825
|
|
|
2826
2826
|
// src/index.ts
|
|
2827
|
-
import { Elysia as
|
|
2827
|
+
import { Elysia as Elysia45 } from "elysia";
|
|
2828
2828
|
|
|
2829
2829
|
// src/apikeys/routes.ts
|
|
2830
2830
|
import { Elysia, t } from "elysia";
|
|
@@ -3044,6 +3044,24 @@ var apiKeysRoutes = ({
|
|
|
3044
3044
|
});
|
|
3045
3045
|
};
|
|
3046
3046
|
|
|
3047
|
+
// src/agents/routes.ts
|
|
3048
|
+
import { Elysia as Elysia3 } from "elysia";
|
|
3049
|
+
|
|
3050
|
+
// src/pluginIdentity.ts
|
|
3051
|
+
var dependencyIds = new WeakMap;
|
|
3052
|
+
var nextDependencyId = 1;
|
|
3053
|
+
var pluginDependencySeed = (dependency) => {
|
|
3054
|
+
if (dependency === undefined)
|
|
3055
|
+
return "default";
|
|
3056
|
+
const existing = dependencyIds.get(dependency);
|
|
3057
|
+
if (existing !== undefined)
|
|
3058
|
+
return existing;
|
|
3059
|
+
const identity = nextDependencyId;
|
|
3060
|
+
nextDependencyId += 1;
|
|
3061
|
+
dependencyIds.set(dependency, identity);
|
|
3062
|
+
return identity;
|
|
3063
|
+
};
|
|
3064
|
+
|
|
3047
3065
|
// src/agents/config.ts
|
|
3048
3066
|
var DEFAULT_AGENT_RESOURCE_METADATA_ROUTE = "/.well-known/oauth-protected-resource";
|
|
3049
3067
|
var agentProtectedResourceMetadata = (config) => ({
|
|
@@ -3155,14 +3173,19 @@ var failureResponse = (config, failure, requiredScopes) => new Response(JSON.str
|
|
|
3155
3173
|
},
|
|
3156
3174
|
status: failure.code === "Forbidden" ? HTTP_FORBIDDEN : HTTP_UNAUTHORIZED2
|
|
3157
3175
|
});
|
|
3158
|
-
var agentAuthContextPlugin = (config) => new Elysia2(
|
|
3176
|
+
var agentAuthContextPlugin = (config) => new Elysia2({
|
|
3177
|
+
name: "@absolutejs/auth/agent-context",
|
|
3178
|
+
seed: pluginDependencySeed(config)
|
|
3179
|
+
}).derive(({ request }) => ({
|
|
3159
3180
|
protectAgent: async (requiredScopes, handleAuth, handleAuthFail) => {
|
|
3160
3181
|
if (config === undefined) {
|
|
3161
3182
|
const failure = {
|
|
3162
3183
|
code: "Unauthorized",
|
|
3163
3184
|
message: "Agent is not authenticated"
|
|
3164
3185
|
};
|
|
3165
|
-
return await handleAuthFail?.(failure) ?? new Response(failure.message, {
|
|
3186
|
+
return await handleAuthFail?.(failure) ?? new Response(failure.message, {
|
|
3187
|
+
status: HTTP_UNAUTHORIZED2
|
|
3188
|
+
});
|
|
3166
3189
|
}
|
|
3167
3190
|
const principal = await resolveAgentPrincipal(request, config);
|
|
3168
3191
|
if (principal === undefined) {
|
|
@@ -3181,7 +3204,7 @@ var agentAuthContextPlugin = (config) => new Elysia2().derive(({ request }) => (
|
|
|
3181
3204
|
}
|
|
3182
3205
|
return handleAuth(principal);
|
|
3183
3206
|
}
|
|
3184
|
-
}));
|
|
3207
|
+
})).as("global");
|
|
3185
3208
|
|
|
3186
3209
|
// src/agents/registration.ts
|
|
3187
3210
|
init_constants();
|
|
@@ -3915,8 +3938,15 @@ var parseRegistrationInput = (value) => {
|
|
|
3915
3938
|
return input;
|
|
3916
3939
|
};
|
|
3917
3940
|
var escapeHtml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
3918
|
-
var agentAuthPlugin = (config) => {
|
|
3919
|
-
|
|
3941
|
+
var agentAuthPlugin = (config) => new Elysia3({
|
|
3942
|
+
name: "@absolutejs/auth/agent",
|
|
3943
|
+
seed: pluginDependencySeed(config)
|
|
3944
|
+
}).use(agentAuthContextPlugin(config)).use(agentAuthRoutes(config)).as("global");
|
|
3945
|
+
var agentAuthRoutes = (config) => {
|
|
3946
|
+
const plugin = new Elysia3({
|
|
3947
|
+
name: "@absolutejs/auth/agent-routes",
|
|
3948
|
+
seed: pluginDependencySeed(config)
|
|
3949
|
+
});
|
|
3920
3950
|
if (config === undefined)
|
|
3921
3951
|
return plugin.as("global");
|
|
3922
3952
|
if (config.agentRegistration === undefined) {
|
|
@@ -4109,8 +4139,11 @@ var composeSignOutAudit = (onSignOut, emit) => async (context) => {
|
|
|
4109
4139
|
return onSignOut?.(context);
|
|
4110
4140
|
};
|
|
4111
4141
|
|
|
4142
|
+
// src/authContext.ts
|
|
4143
|
+
import { Elysia as Elysia8 } from "elysia";
|
|
4144
|
+
|
|
4112
4145
|
// src/authorization/protectPermission.ts
|
|
4113
|
-
import { Elysia as
|
|
4146
|
+
import { Elysia as Elysia5, t as t3 } from "elysia";
|
|
4114
4147
|
|
|
4115
4148
|
// src/session/access.ts
|
|
4116
4149
|
var collectSessionEntries = (session) => Object.entries(session).filter((entry) => isUserSessionId(entry[0]));
|
|
@@ -4224,11 +4257,11 @@ var loadSessionFromSource = async ({
|
|
|
4224
4257
|
};
|
|
4225
4258
|
|
|
4226
4259
|
// src/session/state.ts
|
|
4227
|
-
import { Elysia as
|
|
4260
|
+
import { Elysia as Elysia4 } from "elysia";
|
|
4228
4261
|
var sessionStore = () => {
|
|
4229
4262
|
const initialSession = {};
|
|
4230
4263
|
const initialUnregisteredSession = {};
|
|
4231
|
-
return new
|
|
4264
|
+
return new Elysia4({ name: "sessionStore" }).state({
|
|
4232
4265
|
session: initialSession,
|
|
4233
4266
|
unregisteredSession: initialUnregisteredSession
|
|
4234
4267
|
});
|
|
@@ -4250,7 +4283,10 @@ var protectPermissionPlugin = ({
|
|
|
4250
4283
|
authSessionStore,
|
|
4251
4284
|
emit,
|
|
4252
4285
|
hasPermission
|
|
4253
|
-
}) => new
|
|
4286
|
+
}) => new Elysia5({
|
|
4287
|
+
name: "@absolutejs/auth/permission",
|
|
4288
|
+
seed: pluginDependencySeed(hasPermission)
|
|
4289
|
+
}).use(sessionStore()).guard({ cookie: t3.Cookie({ user_session_id: userSessionIdTypebox }) }).derive(({ store: { session }, cookie: { user_session_id }, status }) => ({
|
|
4254
4290
|
protectPermission: (check, handleAuth, handleAuthFail) => getStatusFromSource({
|
|
4255
4291
|
authSessionStore,
|
|
4256
4292
|
session,
|
|
@@ -4286,8 +4322,80 @@ var protectPermissionPlugin = ({
|
|
|
4286
4322
|
})
|
|
4287
4323
|
})).as("global");
|
|
4288
4324
|
|
|
4325
|
+
// src/routes/protectRoute.ts
|
|
4326
|
+
import { Elysia as Elysia6, t as t4 } from "elysia";
|
|
4327
|
+
var protectRoutePlugin = ({
|
|
4328
|
+
authSessionStore
|
|
4329
|
+
} = {}) => new Elysia6({
|
|
4330
|
+
name: "@absolutejs/auth/protect-route",
|
|
4331
|
+
seed: pluginDependencySeed(authSessionStore)
|
|
4332
|
+
}).use(sessionStore()).guard({ cookie: t4.Cookie({ user_session_id: userSessionIdTypebox }) }).derive(({ store: { session }, cookie: { user_session_id }, status }) => ({
|
|
4333
|
+
protectRoute: (handleAuth, handleAuthFail) => getStatusFromSource({
|
|
4334
|
+
authSessionStore,
|
|
4335
|
+
session,
|
|
4336
|
+
user_session_id
|
|
4337
|
+
}).then(async ({ user, error }) => {
|
|
4338
|
+
if (error) {
|
|
4339
|
+
return handleAuthFail?.(error) ?? status(error.code, error.message);
|
|
4340
|
+
}
|
|
4341
|
+
if (!user) {
|
|
4342
|
+
return handleAuthFail?.({
|
|
4343
|
+
code: "Unauthorized",
|
|
4344
|
+
message: "User is not authenticated"
|
|
4345
|
+
}) ?? status("Unauthorized", "User is not authenticated");
|
|
4346
|
+
}
|
|
4347
|
+
return handleAuth(user);
|
|
4348
|
+
})
|
|
4349
|
+
})).as("global");
|
|
4350
|
+
|
|
4351
|
+
// src/routes/stepUp.ts
|
|
4352
|
+
import { Elysia as Elysia7, t as t5 } from "elysia";
|
|
4353
|
+
var stepUpPlugin = ({
|
|
4354
|
+
authSessionStore
|
|
4355
|
+
} = {}) => new Elysia7({
|
|
4356
|
+
name: "@absolutejs/auth/step-up",
|
|
4357
|
+
seed: pluginDependencySeed(authSessionStore)
|
|
4358
|
+
}).use(sessionStore()).guard({ cookie: t5.Cookie({ user_session_id: userSessionIdTypebox }) }).derive(({ store: { session }, cookie: { user_session_id }, status }) => ({
|
|
4359
|
+
requireRecentAuth: (maxAgeMs, handleAuth, handleAuthFail) => loadSessionFromSource({
|
|
4360
|
+
authSessionStore,
|
|
4361
|
+
session,
|
|
4362
|
+
userSessionId: user_session_id.value
|
|
4363
|
+
}).then((userSession) => {
|
|
4364
|
+
const authenticatedAt = userSession?.authenticatedAt;
|
|
4365
|
+
const isRecent = authenticatedAt !== undefined && Date.now() - authenticatedAt <= maxAgeMs;
|
|
4366
|
+
if (!userSession || !isRecent) {
|
|
4367
|
+
return handleAuthFail?.({
|
|
4368
|
+
code: "Unauthorized",
|
|
4369
|
+
message: "Recent authentication required"
|
|
4370
|
+
}) ?? status("Unauthorized", "Recent authentication required");
|
|
4371
|
+
}
|
|
4372
|
+
return handleAuth(userSession.user);
|
|
4373
|
+
})
|
|
4374
|
+
})).as("global");
|
|
4375
|
+
|
|
4376
|
+
// src/authContext.ts
|
|
4377
|
+
var createAuthContext = ({
|
|
4378
|
+
agentAuth,
|
|
4379
|
+
authSessionStore,
|
|
4380
|
+
authorization,
|
|
4381
|
+
emit,
|
|
4382
|
+
seedSource
|
|
4383
|
+
}) => new Elysia8({
|
|
4384
|
+
name: "@absolutejs/auth/context",
|
|
4385
|
+
seed: pluginDependencySeed(seedSource)
|
|
4386
|
+
}).use([
|
|
4387
|
+
protectRoutePlugin({ authSessionStore }),
|
|
4388
|
+
stepUpPlugin({ authSessionStore }),
|
|
4389
|
+
authorization ? protectPermissionPlugin({
|
|
4390
|
+
...authorization,
|
|
4391
|
+
authSessionStore,
|
|
4392
|
+
emit
|
|
4393
|
+
}) : new Elysia8,
|
|
4394
|
+
agentAuthContextPlugin(agentAuth)
|
|
4395
|
+
]);
|
|
4396
|
+
|
|
4289
4397
|
// src/compliance/routes.ts
|
|
4290
|
-
import { Elysia as
|
|
4398
|
+
import { Elysia as Elysia9, t as t6 } from "elysia";
|
|
4291
4399
|
|
|
4292
4400
|
// src/utils.ts
|
|
4293
4401
|
init_constants();
|
|
@@ -4618,7 +4726,7 @@ var complianceRoutes = ({
|
|
|
4618
4726
|
emit,
|
|
4619
4727
|
exportUserData,
|
|
4620
4728
|
getUserId
|
|
4621
|
-
}) => new
|
|
4729
|
+
}) => new Elysia9().use(sessionStore()).get(`${complianceRoute}/export`, async ({
|
|
4622
4730
|
cookie: { user_session_id },
|
|
4623
4731
|
status,
|
|
4624
4732
|
store: { session }
|
|
@@ -4638,7 +4746,7 @@ var complianceRoutes = ({
|
|
|
4638
4746
|
userId: getUserId?.(current.user)
|
|
4639
4747
|
});
|
|
4640
4748
|
return status("OK", data);
|
|
4641
|
-
}, { cookie:
|
|
4749
|
+
}, { cookie: t6.Cookie({ user_session_id: userSessionIdTypebox }) }).delete(complianceRoute, async ({
|
|
4642
4750
|
cookie: { user_session_id },
|
|
4643
4751
|
status,
|
|
4644
4752
|
store: { session }
|
|
@@ -4671,14 +4779,14 @@ var complianceRoutes = ({
|
|
|
4671
4779
|
userId
|
|
4672
4780
|
});
|
|
4673
4781
|
return status("OK", { deleted: true });
|
|
4674
|
-
}, { cookie:
|
|
4782
|
+
}, { cookie: t6.Cookie({ user_session_id: userSessionIdTypebox }) });
|
|
4675
4783
|
|
|
4676
4784
|
// src/credentials/routes.ts
|
|
4677
|
-
import { Elysia as
|
|
4785
|
+
import { Elysia as Elysia14 } from "elysia";
|
|
4678
4786
|
|
|
4679
4787
|
// src/credentials/emailVerification.ts
|
|
4680
4788
|
init_crypto();
|
|
4681
|
-
import { Elysia as
|
|
4789
|
+
import { Elysia as Elysia10, t as t7 } from "elysia";
|
|
4682
4790
|
|
|
4683
4791
|
// src/credentials/config.ts
|
|
4684
4792
|
init_constants();
|
|
@@ -4693,7 +4801,7 @@ var credentialsEmailVerification = ({
|
|
|
4693
4801
|
onSendEmail,
|
|
4694
4802
|
verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS,
|
|
4695
4803
|
verifyEmailRoute = "/auth/verify-email"
|
|
4696
|
-
}) => new
|
|
4804
|
+
}) => new Elysia10().post(verifyEmailRoute, async ({ body: { token }, status }) => {
|
|
4697
4805
|
const consumed = await credentialStore.consumeVerificationToken(await hashToken(token));
|
|
4698
4806
|
if (!consumed) {
|
|
4699
4807
|
return status("Bad Request", "Invalid or expired verification token");
|
|
@@ -4701,7 +4809,7 @@ var credentialsEmailVerification = ({
|
|
|
4701
4809
|
await credentialStore.setEmailVerified(consumed.email);
|
|
4702
4810
|
await onEmailVerified?.({ email: consumed.email });
|
|
4703
4811
|
return status("OK", { status: "email_verified" });
|
|
4704
|
-
}, { body:
|
|
4812
|
+
}, { body: t7.Object({ token: t7.String() }) }).post(`${verifyEmailRoute}/request`, async ({ body: { email }, status }) => {
|
|
4705
4813
|
const normalizedEmail = email.trim().toLowerCase();
|
|
4706
4814
|
const credential = await credentialStore.getCredentialByEmail(normalizedEmail);
|
|
4707
4815
|
if (credential && !credential.emailVerified) {
|
|
@@ -4720,12 +4828,12 @@ var credentialsEmailVerification = ({
|
|
|
4720
4828
|
});
|
|
4721
4829
|
}
|
|
4722
4830
|
return status("OK", { status: "verification_requested" });
|
|
4723
|
-
}, { body:
|
|
4831
|
+
}, { body: t7.Object({ email: t7.String() }) });
|
|
4724
4832
|
|
|
4725
4833
|
// src/credentials/login.ts
|
|
4726
4834
|
init_constants();
|
|
4727
4835
|
init_crypto();
|
|
4728
|
-
import { Elysia as
|
|
4836
|
+
import { Elysia as Elysia11, t as t8 } from "elysia";
|
|
4729
4837
|
|
|
4730
4838
|
// src/credentials/import.ts
|
|
4731
4839
|
init_crypto();
|
|
@@ -4923,7 +5031,7 @@ var credentialsLogin = ({
|
|
|
4923
5031
|
rehashOnLogin = false,
|
|
4924
5032
|
requireEmailVerification = false,
|
|
4925
5033
|
sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS
|
|
4926
|
-
}) => new
|
|
5034
|
+
}) => new Elysia11().use(sessionStore()).post(loginRoute, async ({
|
|
4927
5035
|
body: { email, password },
|
|
4928
5036
|
cookie: { user_session_id },
|
|
4929
5037
|
request,
|
|
@@ -5006,13 +5114,13 @@ var credentialsLogin = ({
|
|
|
5006
5114
|
status: "authenticated"
|
|
5007
5115
|
});
|
|
5008
5116
|
}), {
|
|
5009
|
-
body:
|
|
5010
|
-
cookie:
|
|
5117
|
+
body: t8.Object({ email: t8.String(), password: t8.String() }),
|
|
5118
|
+
cookie: t8.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5011
5119
|
});
|
|
5012
5120
|
|
|
5013
5121
|
// src/credentials/passwordReset.ts
|
|
5014
5122
|
init_crypto();
|
|
5015
|
-
import { Elysia as
|
|
5123
|
+
import { Elysia as Elysia12, t as t9 } from "elysia";
|
|
5016
5124
|
var credentialsPasswordReset = ({
|
|
5017
5125
|
credentialStore,
|
|
5018
5126
|
onPasswordReset,
|
|
@@ -5020,7 +5128,7 @@ var credentialsPasswordReset = ({
|
|
|
5020
5128
|
passwordPolicy,
|
|
5021
5129
|
resetPasswordRoute = "/auth/reset-password",
|
|
5022
5130
|
resetTokenDurationMs = DEFAULT_RESET_TOKEN_TTL_MS
|
|
5023
|
-
}) => new
|
|
5131
|
+
}) => new Elysia12().post(`${resetPasswordRoute}/request`, async ({ body: { email }, status }) => {
|
|
5024
5132
|
const normalizedEmail = email.trim().toLowerCase();
|
|
5025
5133
|
const credential = await credentialStore.getCredentialByEmail(normalizedEmail);
|
|
5026
5134
|
if (credential && credential.status === "active") {
|
|
@@ -5039,7 +5147,7 @@ var credentialsPasswordReset = ({
|
|
|
5039
5147
|
});
|
|
5040
5148
|
}
|
|
5041
5149
|
return status("OK", { status: "reset_requested" });
|
|
5042
|
-
}, { body:
|
|
5150
|
+
}, { body: t9.Object({ email: t9.String() }) }).post(resetPasswordRoute, async ({ body: { password, token }, status }) => {
|
|
5043
5151
|
const consumed = await credentialStore.consumeResetToken(await hashToken(token));
|
|
5044
5152
|
if (!consumed) {
|
|
5045
5153
|
return status("Bad Request", "Invalid or expired reset token");
|
|
@@ -5066,12 +5174,12 @@ var credentialsPasswordReset = ({
|
|
|
5066
5174
|
await onPasswordReset?.({ email: consumed.email });
|
|
5067
5175
|
return status("OK", { status: "password_reset" });
|
|
5068
5176
|
}, {
|
|
5069
|
-
body:
|
|
5177
|
+
body: t9.Object({ password: t9.String(), token: t9.String() })
|
|
5070
5178
|
});
|
|
5071
5179
|
|
|
5072
5180
|
// src/credentials/register.ts
|
|
5073
5181
|
init_crypto();
|
|
5074
|
-
import { Elysia as
|
|
5182
|
+
import { Elysia as Elysia13, t as t10 } from "elysia";
|
|
5075
5183
|
var credentialsRegister = ({
|
|
5076
5184
|
authSessionStore,
|
|
5077
5185
|
cookieSecure,
|
|
@@ -5085,7 +5193,7 @@ var credentialsRegister = ({
|
|
|
5085
5193
|
requireEmailVerification = false,
|
|
5086
5194
|
sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
|
|
5087
5195
|
verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS
|
|
5088
|
-
}) => new
|
|
5196
|
+
}) => new Elysia13().use(sessionStore()).post(registerRoute, async ({
|
|
5089
5197
|
body: { email, password, ...extraFields },
|
|
5090
5198
|
cookie: { user_session_id },
|
|
5091
5199
|
status,
|
|
@@ -5158,38 +5266,18 @@ var credentialsRegister = ({
|
|
|
5158
5266
|
});
|
|
5159
5267
|
return status("Created", { status: "authenticated" });
|
|
5160
5268
|
}), {
|
|
5161
|
-
body:
|
|
5162
|
-
cookie:
|
|
5269
|
+
body: t10.Object({ email: t10.String(), password: t10.String() }, { additionalProperties: true }),
|
|
5270
|
+
cookie: t10.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5163
5271
|
});
|
|
5164
5272
|
|
|
5165
5273
|
// src/credentials/routes.ts
|
|
5166
|
-
var credentialRoutes = (config) => new
|
|
5274
|
+
var credentialRoutes = (config) => new Elysia14().use(credentialsRegister(config)).use(credentialsEmailVerification(config)).use(credentialsLogin(config)).use(credentialsPasswordReset(config));
|
|
5167
5275
|
|
|
5168
|
-
// src/htmx/
|
|
5169
|
-
import { Elysia as
|
|
5276
|
+
// src/htmx/configuredRoutes.ts
|
|
5277
|
+
import { Elysia as Elysia16 } from "elysia";
|
|
5170
5278
|
|
|
5171
|
-
// src/routes
|
|
5172
|
-
import { Elysia as
|
|
5173
|
-
var protectRoutePlugin = ({
|
|
5174
|
-
authSessionStore
|
|
5175
|
-
} = {}) => new Elysia11().use(sessionStore()).guard({ cookie: t9.Cookie({ user_session_id: userSessionIdTypebox }) }).derive(({ store: { session }, cookie: { user_session_id }, status }) => ({
|
|
5176
|
-
protectRoute: (handleAuth, handleAuthFail) => getStatusFromSource({
|
|
5177
|
-
authSessionStore,
|
|
5178
|
-
session,
|
|
5179
|
-
user_session_id
|
|
5180
|
-
}).then(async ({ user, error }) => {
|
|
5181
|
-
if (error) {
|
|
5182
|
-
return handleAuthFail?.(error) ?? status(error.code, error.message);
|
|
5183
|
-
}
|
|
5184
|
-
if (!user) {
|
|
5185
|
-
return handleAuthFail?.({
|
|
5186
|
-
code: "Unauthorized",
|
|
5187
|
-
message: "User is not authenticated"
|
|
5188
|
-
}) ?? status("Unauthorized", "User is not authenticated");
|
|
5189
|
-
}
|
|
5190
|
-
return handleAuth(user);
|
|
5191
|
-
})
|
|
5192
|
-
})).as("global");
|
|
5279
|
+
// src/htmx/routes.ts
|
|
5280
|
+
import { Elysia as Elysia15 } from "elysia";
|
|
5193
5281
|
|
|
5194
5282
|
// src/htmx/renderers.ts
|
|
5195
5283
|
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
@@ -5281,7 +5369,7 @@ var signInPrompt = `<section class="auth-content"><h1 class="page-heading">Not a
|
|
|
5281
5369
|
var createAuthHtmxRoutes = (config) => {
|
|
5282
5370
|
const renderers = resolveAuthHtmxRenderers(config);
|
|
5283
5371
|
const authorizationHref = config.authorizationHref ?? ((provider) => `/oauth2/${provider}/authorization`);
|
|
5284
|
-
return new
|
|
5372
|
+
return new Elysia15().use(protectRoutePlugin({
|
|
5285
5373
|
authSessionStore: config.authSessionStore
|
|
5286
5374
|
})).get("/htmx/login", () => html(renderers.providerLogin("Sign in with", true))).get("/htmx/link", () => html(renderers.providerLogin("Link", false))).get("/htmx/connector-links", () => html(renderers.connectorLinks())).get("/htmx/auth-menu", ({ protectRoute }) => protectRoute((user) => html(renderers.authMenu(user)), () => html(renderers.authMenu(null)))).get("/htmx/me", ({ protectRoute }) => protectRoute((user) => html(renderers.protected(user)), () => html(signInPrompt))).get("/htmx/account", ({ protectRoute }) => protectRoute((user) => html(renderers.account(user)), () => html(signInPrompt))).get("/htmx/identities", ({ protectRoute, query }) => protectRoute(async (user) => {
|
|
5287
5375
|
const search = typeof query.query === "string" ? query.query : "";
|
|
@@ -5352,6 +5440,39 @@ var createAuthHtmxRoutes = (config) => {
|
|
|
5352
5440
|
});
|
|
5353
5441
|
};
|
|
5354
5442
|
|
|
5443
|
+
// src/htmx/configuredRoutes.ts
|
|
5444
|
+
var isNullableString = (value) => value === undefined || value === null || typeof value === "string";
|
|
5445
|
+
var isAuthHtmxUser = (value) => {
|
|
5446
|
+
if (typeof value !== "object" || value === null)
|
|
5447
|
+
return false;
|
|
5448
|
+
return typeof Reflect.get(value, "sub") === "string" && isNullableString(Reflect.get(value, "email")) && isNullableString(Reflect.get(value, "first_name")) && isNullableString(Reflect.get(value, "last_name")) && isNullableString(Reflect.get(value, "primary_auth_identity_id"));
|
|
5449
|
+
};
|
|
5450
|
+
var htmxSessionSource = (store) => {
|
|
5451
|
+
if (store === undefined)
|
|
5452
|
+
return;
|
|
5453
|
+
return {
|
|
5454
|
+
getSession: async (id) => {
|
|
5455
|
+
const session = await store.getSession(id);
|
|
5456
|
+
if (session === undefined || !isAuthHtmxUser(session.user)) {
|
|
5457
|
+
return;
|
|
5458
|
+
}
|
|
5459
|
+
const result = {
|
|
5460
|
+
...session,
|
|
5461
|
+
user: session.user
|
|
5462
|
+
};
|
|
5463
|
+
return result;
|
|
5464
|
+
},
|
|
5465
|
+
removeSession: (id) => store.removeSession(id)
|
|
5466
|
+
};
|
|
5467
|
+
};
|
|
5468
|
+
var createConfiguredAuthHtmxRoutes = ({
|
|
5469
|
+
authSessionStore,
|
|
5470
|
+
config
|
|
5471
|
+
}) => config === undefined ? new Elysia16 : createAuthHtmxRoutes({
|
|
5472
|
+
...config,
|
|
5473
|
+
authSessionStore: htmxSessionSource(authSessionStore)
|
|
5474
|
+
});
|
|
5475
|
+
|
|
5355
5476
|
// src/lockout/config.ts
|
|
5356
5477
|
init_constants();
|
|
5357
5478
|
var DEFAULT_MAX_ATTEMPTS = 5;
|
|
@@ -5387,11 +5508,11 @@ var isMfaEnrolled = (enrollment) => enrollment !== undefined && (enrollment.totp
|
|
|
5387
5508
|
var createMfaGate = ({ getUserId, mfaStore }) => async (user) => isMfaEnrolled(await mfaStore.getEnrollment(getUserId(user)));
|
|
5388
5509
|
|
|
5389
5510
|
// src/mfa/routes.ts
|
|
5390
|
-
import { Elysia as
|
|
5511
|
+
import { Elysia as Elysia21 } from "elysia";
|
|
5391
5512
|
|
|
5392
5513
|
// src/mfa/challenge.ts
|
|
5393
5514
|
init_crypto();
|
|
5394
|
-
import { Elysia as
|
|
5515
|
+
import { Elysia as Elysia18, t as t12 } from "elysia";
|
|
5395
5516
|
|
|
5396
5517
|
// src/mfa/backupCodes.ts
|
|
5397
5518
|
init_crypto();
|
|
@@ -5427,7 +5548,7 @@ var encryptTotpSecret = (secret, encryptionKey) => encryptionKey ? encryptSecret
|
|
|
5427
5548
|
|
|
5428
5549
|
// src/mfa/sms.ts
|
|
5429
5550
|
init_crypto();
|
|
5430
|
-
import { Elysia as
|
|
5551
|
+
import { Elysia as Elysia17, t as t11 } from "elysia";
|
|
5431
5552
|
var DECIMAL_RADIX2 = 10;
|
|
5432
5553
|
var MASK_VISIBLE_DIGITS = 4;
|
|
5433
5554
|
var E164_PATTERN = /^\+[1-9]\d{7,14}$/u;
|
|
@@ -5480,7 +5601,7 @@ var mfaSmsRoutes = ({
|
|
|
5480
5601
|
smsMaxAttempts = DEFAULT_SMS_MAX_ATTEMPTS,
|
|
5481
5602
|
smsSetupRoute = "/auth/mfa/sms/setup",
|
|
5482
5603
|
smsVerifyRoute = "/auth/mfa/sms/verify"
|
|
5483
|
-
}) => new
|
|
5604
|
+
}) => new Elysia17().use(sessionStore()).post(smsSetupRoute, async ({
|
|
5484
5605
|
body: { phone },
|
|
5485
5606
|
cookie: { user_session_id },
|
|
5486
5607
|
status,
|
|
@@ -5520,8 +5641,8 @@ var mfaSmsRoutes = ({
|
|
|
5520
5641
|
await onSendSmsCode({ code, expiresAt, phone });
|
|
5521
5642
|
return status("OK", { phone: maskPhone(phone) });
|
|
5522
5643
|
}, {
|
|
5523
|
-
body:
|
|
5524
|
-
cookie:
|
|
5644
|
+
body: t11.Object({ phone: t11.String() }),
|
|
5645
|
+
cookie: t11.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5525
5646
|
}).post(smsVerifyRoute, async ({
|
|
5526
5647
|
body: { code },
|
|
5527
5648
|
cookie: { user_session_id },
|
|
@@ -5567,8 +5688,8 @@ var mfaSmsRoutes = ({
|
|
|
5567
5688
|
await onMfaEnrolled?.({ userId });
|
|
5568
5689
|
return status("OK", { status: "enrolled" });
|
|
5569
5690
|
}, {
|
|
5570
|
-
body:
|
|
5571
|
-
cookie:
|
|
5691
|
+
body: t11.Object({ code: t11.String() }),
|
|
5692
|
+
cookie: t11.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5572
5693
|
});
|
|
5573
5694
|
|
|
5574
5695
|
// src/mfa/challenge.ts
|
|
@@ -5588,7 +5709,7 @@ var mfaChallenge = ({
|
|
|
5588
5709
|
smsCodeTtlMs = DEFAULT_SMS_CODE_TTL_MS,
|
|
5589
5710
|
smsMaxAttempts = DEFAULT_SMS_MAX_ATTEMPTS,
|
|
5590
5711
|
totpMaxAttempts = DEFAULT_TOTP_MAX_ATTEMPTS
|
|
5591
|
-
}) => new
|
|
5712
|
+
}) => new Elysia18().use(sessionStore()).post(challengeRoute, async ({
|
|
5592
5713
|
body: { action, code, factor },
|
|
5593
5714
|
cookie: { user_session_id },
|
|
5594
5715
|
status,
|
|
@@ -5719,16 +5840,16 @@ var mfaChallenge = ({
|
|
|
5719
5840
|
});
|
|
5720
5841
|
return promote();
|
|
5721
5842
|
}), {
|
|
5722
|
-
body:
|
|
5723
|
-
action:
|
|
5724
|
-
code:
|
|
5725
|
-
factor:
|
|
5843
|
+
body: t12.Object({
|
|
5844
|
+
action: t12.Optional(t12.Union([t12.Literal("send"), t12.Literal("verify")])),
|
|
5845
|
+
code: t12.Optional(t12.String()),
|
|
5846
|
+
factor: t12.Optional(t12.Literal("sms"))
|
|
5726
5847
|
}),
|
|
5727
|
-
cookie:
|
|
5848
|
+
cookie: t12.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5728
5849
|
});
|
|
5729
5850
|
|
|
5730
5851
|
// src/mfa/management.ts
|
|
5731
|
-
import { Elysia as
|
|
5852
|
+
import { Elysia as Elysia19, t as t13 } from "elysia";
|
|
5732
5853
|
var maskPhone2 = (phone) => {
|
|
5733
5854
|
if (!phone)
|
|
5734
5855
|
return null;
|
|
@@ -5741,7 +5862,7 @@ var mfaManagementRoutes = ({
|
|
|
5741
5862
|
getUserId,
|
|
5742
5863
|
managementRoute = "/auth/mfa",
|
|
5743
5864
|
mfaStore
|
|
5744
|
-
}) => new
|
|
5865
|
+
}) => new Elysia19().use(sessionStore()).get(managementRoute, async ({
|
|
5745
5866
|
cookie: { user_session_id },
|
|
5746
5867
|
status,
|
|
5747
5868
|
store: { session }
|
|
@@ -5765,7 +5886,7 @@ var mfaManagementRoutes = ({
|
|
|
5765
5886
|
totp: { enabled: enrollment?.totpVerified ?? false }
|
|
5766
5887
|
};
|
|
5767
5888
|
return status("OK", response);
|
|
5768
|
-
}, { cookie:
|
|
5889
|
+
}, { cookie: t13.Cookie({ user_session_id: userSessionIdTypebox }) }).delete(managementRoute, async ({
|
|
5769
5890
|
cookie: { user_session_id },
|
|
5770
5891
|
status,
|
|
5771
5892
|
store: { session }
|
|
@@ -5780,11 +5901,11 @@ var mfaManagementRoutes = ({
|
|
|
5780
5901
|
}
|
|
5781
5902
|
await mfaStore.removeEnrollment(getUserId(userSession.user));
|
|
5782
5903
|
return status("OK", { status: "disabled" });
|
|
5783
|
-
}, { cookie:
|
|
5904
|
+
}, { cookie: t13.Cookie({ user_session_id: userSessionIdTypebox }) });
|
|
5784
5905
|
|
|
5785
5906
|
// src/mfa/totp.ts
|
|
5786
5907
|
init_crypto();
|
|
5787
|
-
import { Elysia as
|
|
5908
|
+
import { Elysia as Elysia20, t as t14 } from "elysia";
|
|
5788
5909
|
var mfaTotpRoutes = ({
|
|
5789
5910
|
authSessionStore,
|
|
5790
5911
|
backupCodeCount = DEFAULT_BACKUP_CODE_COUNT,
|
|
@@ -5795,7 +5916,7 @@ var mfaTotpRoutes = ({
|
|
|
5795
5916
|
onMfaEnrolled,
|
|
5796
5917
|
totpSetupRoute = "/auth/mfa/totp/setup",
|
|
5797
5918
|
totpVerifyRoute = "/auth/mfa/totp/verify"
|
|
5798
|
-
}) => new
|
|
5919
|
+
}) => new Elysia20().use(sessionStore()).post(totpSetupRoute, async ({
|
|
5799
5920
|
cookie: { user_session_id },
|
|
5800
5921
|
status,
|
|
5801
5922
|
store: { session }
|
|
@@ -5833,7 +5954,7 @@ var mfaTotpRoutes = ({
|
|
|
5833
5954
|
secret
|
|
5834
5955
|
})
|
|
5835
5956
|
});
|
|
5836
|
-
}, { cookie:
|
|
5957
|
+
}, { cookie: t14.Cookie({ user_session_id: userSessionIdTypebox }) }).post(totpVerifyRoute, async ({
|
|
5837
5958
|
body: { code },
|
|
5838
5959
|
cookie: { user_session_id },
|
|
5839
5960
|
status,
|
|
@@ -5867,17 +5988,17 @@ var mfaTotpRoutes = ({
|
|
|
5867
5988
|
await onMfaEnrolled?.({ userId });
|
|
5868
5989
|
return status("OK", { backupCodes: codes });
|
|
5869
5990
|
}, {
|
|
5870
|
-
body:
|
|
5871
|
-
cookie:
|
|
5991
|
+
body: t14.Object({ code: t14.String() }),
|
|
5992
|
+
cookie: t14.Cookie({ user_session_id: userSessionIdTypebox })
|
|
5872
5993
|
});
|
|
5873
5994
|
|
|
5874
5995
|
// src/mfa/routes.ts
|
|
5875
|
-
var mfaRoutes = (config) => new
|
|
5996
|
+
var mfaRoutes = (config) => new Elysia21().use(mfaManagementRoutes(config)).use(mfaTotpRoutes(config)).use(mfaSmsRoutes(config)).use(mfaChallenge(config));
|
|
5876
5997
|
|
|
5877
5998
|
// src/oidc/routes.ts
|
|
5878
5999
|
init_constants();
|
|
5879
6000
|
init_crypto();
|
|
5880
|
-
import { Elysia as
|
|
6001
|
+
import { Elysia as Elysia22, t as t15 } from "elysia";
|
|
5881
6002
|
|
|
5882
6003
|
// src/oidc/config.ts
|
|
5883
6004
|
init_constants();
|
|
@@ -7916,7 +8037,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
7916
8037
|
url.searchParams.set("state", query.state);
|
|
7917
8038
|
return redirectTo(url.toString());
|
|
7918
8039
|
};
|
|
7919
|
-
return new
|
|
8040
|
+
return new Elysia22().use(sessionStore()).get(authorizeRoute, async ({
|
|
7920
8041
|
cookie: { user_session_id },
|
|
7921
8042
|
query,
|
|
7922
8043
|
request,
|
|
@@ -8071,26 +8192,26 @@ var oidcProviderRoutes = (config) => {
|
|
|
8071
8192
|
params.state = state;
|
|
8072
8193
|
return respondToClient(redirectUri, responseMode, params);
|
|
8073
8194
|
}, {
|
|
8074
|
-
cookie:
|
|
8075
|
-
user_session_id:
|
|
8195
|
+
cookie: t15.Cookie({
|
|
8196
|
+
user_session_id: t15.Optional(userSessionIdTypebox)
|
|
8076
8197
|
}),
|
|
8077
|
-
query:
|
|
8078
|
-
acr_values:
|
|
8079
|
-
claims:
|
|
8080
|
-
client_id:
|
|
8081
|
-
code_challenge:
|
|
8082
|
-
code_challenge_method:
|
|
8083
|
-
id_token_hint:
|
|
8084
|
-
max_age:
|
|
8085
|
-
nonce:
|
|
8086
|
-
prompt:
|
|
8087
|
-
redirect_uri:
|
|
8088
|
-
request:
|
|
8089
|
-
request_uri:
|
|
8090
|
-
response_mode:
|
|
8091
|
-
response_type:
|
|
8092
|
-
scope:
|
|
8093
|
-
state:
|
|
8198
|
+
query: t15.Object({
|
|
8199
|
+
acr_values: t15.Optional(t15.String()),
|
|
8200
|
+
claims: t15.Optional(t15.String()),
|
|
8201
|
+
client_id: t15.Optional(t15.String()),
|
|
8202
|
+
code_challenge: t15.Optional(t15.String()),
|
|
8203
|
+
code_challenge_method: t15.Optional(t15.String()),
|
|
8204
|
+
id_token_hint: t15.Optional(t15.String()),
|
|
8205
|
+
max_age: t15.Optional(t15.String()),
|
|
8206
|
+
nonce: t15.Optional(t15.String()),
|
|
8207
|
+
prompt: t15.Optional(t15.String()),
|
|
8208
|
+
redirect_uri: t15.Optional(t15.String()),
|
|
8209
|
+
request: t15.Optional(t15.String()),
|
|
8210
|
+
request_uri: t15.Optional(t15.String()),
|
|
8211
|
+
response_mode: t15.Optional(t15.String()),
|
|
8212
|
+
response_type: t15.Optional(t15.String()),
|
|
8213
|
+
scope: t15.Optional(t15.String()),
|
|
8214
|
+
state: t15.Optional(t15.String())
|
|
8094
8215
|
})
|
|
8095
8216
|
}).post(tokenRoute, async ({ body, headers, request }) => {
|
|
8096
8217
|
if (body.grant_type === PRE_AUTHORIZED_CODE_GRANT && config.vciConfig !== undefined) {
|
|
@@ -8157,26 +8278,26 @@ var oidcProviderRoutes = (config) => {
|
|
|
8157
8278
|
}
|
|
8158
8279
|
return oauthError2(HTTP_BAD_REQUEST3, "unsupported_grant_type");
|
|
8159
8280
|
}, {
|
|
8160
|
-
body:
|
|
8161
|
-
assertion:
|
|
8162
|
-
audience:
|
|
8163
|
-
auth_req_id:
|
|
8164
|
-
claim_token:
|
|
8165
|
-
client_assertion:
|
|
8166
|
-
client_assertion_type:
|
|
8167
|
-
client_id:
|
|
8168
|
-
client_secret:
|
|
8169
|
-
code:
|
|
8170
|
-
code_verifier:
|
|
8171
|
-
device_code:
|
|
8172
|
-
grant_type:
|
|
8173
|
-
"pre-authorized_code":
|
|
8174
|
-
redirect_uri:
|
|
8175
|
-
refresh_token:
|
|
8176
|
-
resource:
|
|
8177
|
-
scope:
|
|
8178
|
-
subject_token:
|
|
8179
|
-
subject_token_type:
|
|
8281
|
+
body: t15.Object({
|
|
8282
|
+
assertion: t15.Optional(t15.String()),
|
|
8283
|
+
audience: t15.Optional(t15.String()),
|
|
8284
|
+
auth_req_id: t15.Optional(t15.String()),
|
|
8285
|
+
claim_token: t15.Optional(t15.String()),
|
|
8286
|
+
client_assertion: t15.Optional(t15.String()),
|
|
8287
|
+
client_assertion_type: t15.Optional(t15.String()),
|
|
8288
|
+
client_id: t15.Optional(t15.String()),
|
|
8289
|
+
client_secret: t15.Optional(t15.String()),
|
|
8290
|
+
code: t15.Optional(t15.String()),
|
|
8291
|
+
code_verifier: t15.Optional(t15.String()),
|
|
8292
|
+
device_code: t15.Optional(t15.String()),
|
|
8293
|
+
grant_type: t15.Optional(t15.String()),
|
|
8294
|
+
"pre-authorized_code": t15.Optional(t15.String()),
|
|
8295
|
+
redirect_uri: t15.Optional(t15.String()),
|
|
8296
|
+
refresh_token: t15.Optional(t15.String()),
|
|
8297
|
+
resource: t15.Optional(t15.String()),
|
|
8298
|
+
scope: t15.Optional(t15.String()),
|
|
8299
|
+
subject_token: t15.Optional(t15.String()),
|
|
8300
|
+
subject_token_type: t15.Optional(t15.String())
|
|
8180
8301
|
})
|
|
8181
8302
|
}).post(parRoute, async ({ body, headers, request }) => {
|
|
8182
8303
|
if (config.pushedAuthorizationRequestStore === undefined) {
|
|
@@ -8206,25 +8327,25 @@ var oidcProviderRoutes = (config) => {
|
|
|
8206
8327
|
});
|
|
8207
8328
|
return jsonResponse(result.body, result.ok ? HTTP_OK3 : result.status);
|
|
8208
8329
|
}, {
|
|
8209
|
-
body:
|
|
8210
|
-
acr_values:
|
|
8211
|
-
audience:
|
|
8212
|
-
claims:
|
|
8213
|
-
client_assertion:
|
|
8214
|
-
client_assertion_type:
|
|
8215
|
-
client_id:
|
|
8216
|
-
client_secret:
|
|
8217
|
-
code_challenge:
|
|
8218
|
-
code_challenge_method:
|
|
8219
|
-
nonce:
|
|
8220
|
-
redirect_uri:
|
|
8221
|
-
resource:
|
|
8222
|
-
response_type:
|
|
8223
|
-
scope:
|
|
8224
|
-
state:
|
|
8330
|
+
body: t15.Object({
|
|
8331
|
+
acr_values: t15.Optional(t15.String()),
|
|
8332
|
+
audience: t15.Optional(t15.String()),
|
|
8333
|
+
claims: t15.Optional(t15.String()),
|
|
8334
|
+
client_assertion: t15.Optional(t15.String()),
|
|
8335
|
+
client_assertion_type: t15.Optional(t15.String()),
|
|
8336
|
+
client_id: t15.Optional(t15.String()),
|
|
8337
|
+
client_secret: t15.Optional(t15.String()),
|
|
8338
|
+
code_challenge: t15.Optional(t15.String()),
|
|
8339
|
+
code_challenge_method: t15.Optional(t15.String()),
|
|
8340
|
+
nonce: t15.Optional(t15.String()),
|
|
8341
|
+
redirect_uri: t15.Optional(t15.String()),
|
|
8342
|
+
resource: t15.Optional(t15.String()),
|
|
8343
|
+
response_type: t15.Optional(t15.String()),
|
|
8344
|
+
scope: t15.Optional(t15.String()),
|
|
8345
|
+
state: t15.Optional(t15.String())
|
|
8225
8346
|
}),
|
|
8226
|
-
headers:
|
|
8227
|
-
authorization:
|
|
8347
|
+
headers: t15.Object({
|
|
8348
|
+
authorization: t15.Optional(t15.String())
|
|
8228
8349
|
})
|
|
8229
8350
|
}).post(introspectRoute, async ({ body, headers }) => {
|
|
8230
8351
|
const basic = readBasicAuth2(headers.authorization);
|
|
@@ -8245,14 +8366,14 @@ var oidcProviderRoutes = (config) => {
|
|
|
8245
8366
|
});
|
|
8246
8367
|
return jsonResponse(result, HTTP_OK3);
|
|
8247
8368
|
}, {
|
|
8248
|
-
body:
|
|
8249
|
-
client_id:
|
|
8250
|
-
client_secret:
|
|
8251
|
-
token:
|
|
8252
|
-
token_type_hint:
|
|
8369
|
+
body: t15.Object({
|
|
8370
|
+
client_id: t15.Optional(t15.String()),
|
|
8371
|
+
client_secret: t15.Optional(t15.String()),
|
|
8372
|
+
token: t15.String(),
|
|
8373
|
+
token_type_hint: t15.Optional(t15.String())
|
|
8253
8374
|
}),
|
|
8254
|
-
headers:
|
|
8255
|
-
authorization:
|
|
8375
|
+
headers: t15.Object({
|
|
8376
|
+
authorization: t15.Optional(t15.String())
|
|
8256
8377
|
})
|
|
8257
8378
|
}).post(revokeRoute, async ({ body, headers }) => {
|
|
8258
8379
|
const basic = readBasicAuth2(headers.authorization);
|
|
@@ -8270,14 +8391,14 @@ var oidcProviderRoutes = (config) => {
|
|
|
8270
8391
|
}
|
|
8271
8392
|
return new Response(null, { status: HTTP_OK3 });
|
|
8272
8393
|
}, {
|
|
8273
|
-
body:
|
|
8274
|
-
client_id:
|
|
8275
|
-
client_secret:
|
|
8276
|
-
token:
|
|
8277
|
-
token_type_hint:
|
|
8394
|
+
body: t15.Object({
|
|
8395
|
+
client_id: t15.Optional(t15.String()),
|
|
8396
|
+
client_secret: t15.Optional(t15.String()),
|
|
8397
|
+
token: t15.String(),
|
|
8398
|
+
token_type_hint: t15.Optional(t15.String())
|
|
8278
8399
|
}),
|
|
8279
|
-
headers:
|
|
8280
|
-
authorization:
|
|
8400
|
+
headers: t15.Object({
|
|
8401
|
+
authorization: t15.Optional(t15.String())
|
|
8281
8402
|
})
|
|
8282
8403
|
}).post(backchannelAuthorizationRoute, async ({ body, headers }) => {
|
|
8283
8404
|
if (config.backchannelAuthStore === undefined) {
|
|
@@ -8313,15 +8434,15 @@ var oidcProviderRoutes = (config) => {
|
|
|
8313
8434
|
interval: result.interval
|
|
8314
8435
|
}, HTTP_OK3);
|
|
8315
8436
|
}, {
|
|
8316
|
-
body:
|
|
8317
|
-
binding_message:
|
|
8318
|
-
client_id:
|
|
8319
|
-
client_secret:
|
|
8320
|
-
login_hint:
|
|
8321
|
-
scope:
|
|
8437
|
+
body: t15.Object({
|
|
8438
|
+
binding_message: t15.Optional(t15.String()),
|
|
8439
|
+
client_id: t15.Optional(t15.String()),
|
|
8440
|
+
client_secret: t15.Optional(t15.String()),
|
|
8441
|
+
login_hint: t15.Optional(t15.String()),
|
|
8442
|
+
scope: t15.Optional(t15.String())
|
|
8322
8443
|
}),
|
|
8323
|
-
headers:
|
|
8324
|
-
authorization:
|
|
8444
|
+
headers: t15.Object({
|
|
8445
|
+
authorization: t15.Optional(t15.String())
|
|
8325
8446
|
})
|
|
8326
8447
|
}).post(deviceAuthorizationRoute, async ({ body, headers }) => {
|
|
8327
8448
|
if (config.deviceAuthorizationStore === undefined) {
|
|
@@ -8346,13 +8467,13 @@ var oidcProviderRoutes = (config) => {
|
|
|
8346
8467
|
});
|
|
8347
8468
|
return jsonResponse(response, HTTP_OK3);
|
|
8348
8469
|
}, {
|
|
8349
|
-
body:
|
|
8350
|
-
client_id:
|
|
8351
|
-
client_secret:
|
|
8352
|
-
scope:
|
|
8470
|
+
body: t15.Object({
|
|
8471
|
+
client_id: t15.Optional(t15.String()),
|
|
8472
|
+
client_secret: t15.Optional(t15.String()),
|
|
8473
|
+
scope: t15.Optional(t15.String())
|
|
8353
8474
|
}),
|
|
8354
|
-
headers:
|
|
8355
|
-
authorization:
|
|
8475
|
+
headers: t15.Object({
|
|
8476
|
+
authorization: t15.Optional(t15.String())
|
|
8356
8477
|
})
|
|
8357
8478
|
}).post(deviceApproveRoute, async ({ body, cookie: { user_session_id }, store }) => {
|
|
8358
8479
|
if (config.deviceAuthorizationStore === undefined) {
|
|
@@ -8378,40 +8499,40 @@ var oidcProviderRoutes = (config) => {
|
|
|
8378
8499
|
return oauthError2(HTTP_BAD_REQUEST3, result.error);
|
|
8379
8500
|
return jsonResponse({ ok: true }, HTTP_OK3);
|
|
8380
8501
|
}, {
|
|
8381
|
-
body:
|
|
8382
|
-
action:
|
|
8383
|
-
user_code:
|
|
8502
|
+
body: t15.Object({
|
|
8503
|
+
action: t15.Optional(t15.Union([t15.Literal("approve"), t15.Literal("deny")])),
|
|
8504
|
+
user_code: t15.String()
|
|
8384
8505
|
}),
|
|
8385
|
-
cookie:
|
|
8386
|
-
user_session_id:
|
|
8506
|
+
cookie: t15.Cookie({
|
|
8507
|
+
user_session_id: t15.Optional(userSessionIdTypebox)
|
|
8387
8508
|
})
|
|
8388
8509
|
}).get(endSessionRoute, async ({ cookie: { user_session_id }, query, store }) => handleEndSession({
|
|
8389
8510
|
cookie: user_session_id,
|
|
8390
8511
|
inMemorySession: store.session,
|
|
8391
8512
|
query
|
|
8392
8513
|
}), {
|
|
8393
|
-
cookie:
|
|
8394
|
-
user_session_id:
|
|
8514
|
+
cookie: t15.Cookie({
|
|
8515
|
+
user_session_id: t15.Optional(userSessionIdTypebox)
|
|
8395
8516
|
}),
|
|
8396
|
-
query:
|
|
8397
|
-
client_id:
|
|
8398
|
-
id_token_hint:
|
|
8399
|
-
post_logout_redirect_uri:
|
|
8400
|
-
state:
|
|
8517
|
+
query: t15.Object({
|
|
8518
|
+
client_id: t15.Optional(t15.String()),
|
|
8519
|
+
id_token_hint: t15.Optional(t15.String()),
|
|
8520
|
+
post_logout_redirect_uri: t15.Optional(t15.String()),
|
|
8521
|
+
state: t15.Optional(t15.String())
|
|
8401
8522
|
})
|
|
8402
8523
|
}).post(endSessionRoute, async ({ body, cookie: { user_session_id }, store }) => handleEndSession({
|
|
8403
8524
|
cookie: user_session_id,
|
|
8404
8525
|
inMemorySession: store.session,
|
|
8405
8526
|
query: body
|
|
8406
8527
|
}), {
|
|
8407
|
-
body:
|
|
8408
|
-
client_id:
|
|
8409
|
-
id_token_hint:
|
|
8410
|
-
post_logout_redirect_uri:
|
|
8411
|
-
state:
|
|
8528
|
+
body: t15.Object({
|
|
8529
|
+
client_id: t15.Optional(t15.String()),
|
|
8530
|
+
id_token_hint: t15.Optional(t15.String()),
|
|
8531
|
+
post_logout_redirect_uri: t15.Optional(t15.String()),
|
|
8532
|
+
state: t15.Optional(t15.String())
|
|
8412
8533
|
}),
|
|
8413
|
-
cookie:
|
|
8414
|
-
user_session_id:
|
|
8534
|
+
cookie: t15.Cookie({
|
|
8535
|
+
user_session_id: t15.Optional(userSessionIdTypebox)
|
|
8415
8536
|
})
|
|
8416
8537
|
}).post(registrationRoute, async ({ body, headers }) => {
|
|
8417
8538
|
if (config.clientRegistrationTokenStore === undefined) {
|
|
@@ -8430,18 +8551,18 @@ var oidcProviderRoutes = (config) => {
|
|
|
8430
8551
|
});
|
|
8431
8552
|
return jsonResponse(result.body, result.ok ? HTTP_OK3 : result.status);
|
|
8432
8553
|
}, {
|
|
8433
|
-
body:
|
|
8434
|
-
backchannel_logout_uri:
|
|
8435
|
-
client_name:
|
|
8436
|
-
grant_types:
|
|
8437
|
-
jwks:
|
|
8438
|
-
jwks_uri:
|
|
8439
|
-
post_logout_redirect_uris:
|
|
8440
|
-
redirect_uris:
|
|
8441
|
-
scope:
|
|
8554
|
+
body: t15.Object({
|
|
8555
|
+
backchannel_logout_uri: t15.Optional(t15.String()),
|
|
8556
|
+
client_name: t15.Optional(t15.String()),
|
|
8557
|
+
grant_types: t15.Optional(t15.Array(t15.String())),
|
|
8558
|
+
jwks: t15.Optional(t15.Any()),
|
|
8559
|
+
jwks_uri: t15.Optional(t15.String()),
|
|
8560
|
+
post_logout_redirect_uris: t15.Optional(t15.Array(t15.String())),
|
|
8561
|
+
redirect_uris: t15.Optional(t15.Array(t15.String())),
|
|
8562
|
+
scope: t15.Optional(t15.String())
|
|
8442
8563
|
}),
|
|
8443
|
-
headers:
|
|
8444
|
-
authorization:
|
|
8564
|
+
headers: t15.Object({
|
|
8565
|
+
authorization: t15.Optional(t15.String())
|
|
8445
8566
|
})
|
|
8446
8567
|
}).get(`${registrationRoute}/:clientId`, async ({ headers, params: { clientId } }) => {
|
|
8447
8568
|
if (config.clientRegistrationTokenStore === undefined) {
|
|
@@ -8455,10 +8576,10 @@ var oidcProviderRoutes = (config) => {
|
|
|
8455
8576
|
});
|
|
8456
8577
|
return jsonResponse(result.body, result.status);
|
|
8457
8578
|
}, {
|
|
8458
|
-
headers:
|
|
8459
|
-
authorization:
|
|
8579
|
+
headers: t15.Object({
|
|
8580
|
+
authorization: t15.Optional(t15.String())
|
|
8460
8581
|
}),
|
|
8461
|
-
params:
|
|
8582
|
+
params: t15.Object({ clientId: t15.String() })
|
|
8462
8583
|
}).put(`${registrationRoute}/:clientId`, async ({ body, headers, params: { clientId } }) => {
|
|
8463
8584
|
if (config.clientRegistrationTokenStore === undefined) {
|
|
8464
8585
|
return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
|
|
@@ -8473,20 +8594,20 @@ var oidcProviderRoutes = (config) => {
|
|
|
8473
8594
|
});
|
|
8474
8595
|
return jsonResponse(result.body, result.status);
|
|
8475
8596
|
}, {
|
|
8476
|
-
body:
|
|
8477
|
-
backchannel_logout_uri:
|
|
8478
|
-
client_name:
|
|
8479
|
-
grant_types:
|
|
8480
|
-
jwks:
|
|
8481
|
-
jwks_uri:
|
|
8482
|
-
post_logout_redirect_uris:
|
|
8483
|
-
redirect_uris:
|
|
8484
|
-
scope:
|
|
8597
|
+
body: t15.Object({
|
|
8598
|
+
backchannel_logout_uri: t15.Optional(t15.String()),
|
|
8599
|
+
client_name: t15.Optional(t15.String()),
|
|
8600
|
+
grant_types: t15.Optional(t15.Array(t15.String())),
|
|
8601
|
+
jwks: t15.Optional(t15.Any()),
|
|
8602
|
+
jwks_uri: t15.Optional(t15.String()),
|
|
8603
|
+
post_logout_redirect_uris: t15.Optional(t15.Array(t15.String())),
|
|
8604
|
+
redirect_uris: t15.Optional(t15.Array(t15.String())),
|
|
8605
|
+
scope: t15.Optional(t15.String())
|
|
8485
8606
|
}),
|
|
8486
|
-
headers:
|
|
8487
|
-
authorization:
|
|
8607
|
+
headers: t15.Object({
|
|
8608
|
+
authorization: t15.Optional(t15.String())
|
|
8488
8609
|
}),
|
|
8489
|
-
params:
|
|
8610
|
+
params: t15.Object({ clientId: t15.String() })
|
|
8490
8611
|
}).delete(`${registrationRoute}/:clientId`, async ({ headers, params: { clientId } }) => {
|
|
8491
8612
|
if (config.clientRegistrationTokenStore === undefined) {
|
|
8492
8613
|
return jsonResponse({ error: "unsupported_response_type" }, HTTP_NOT_IMPLEMENTED);
|
|
@@ -8502,10 +8623,10 @@ var oidcProviderRoutes = (config) => {
|
|
|
8502
8623
|
}
|
|
8503
8624
|
return jsonResponse(result.body, result.status);
|
|
8504
8625
|
}, {
|
|
8505
|
-
headers:
|
|
8506
|
-
authorization:
|
|
8626
|
+
headers: t15.Object({
|
|
8627
|
+
authorization: t15.Optional(t15.String())
|
|
8507
8628
|
}),
|
|
8508
|
-
params:
|
|
8629
|
+
params: t15.Object({ clientId: t15.String() })
|
|
8509
8630
|
}).get(userinfoRoute, async ({ headers }) => {
|
|
8510
8631
|
const token = readUserInfoBearer(headers.authorization);
|
|
8511
8632
|
const result = await fetchUserInfo({ config, token });
|
|
@@ -8520,8 +8641,8 @@ var oidcProviderRoutes = (config) => {
|
|
|
8520
8641
|
}
|
|
8521
8642
|
return jsonResponse(result.body, HTTP_OK3);
|
|
8522
8643
|
}, {
|
|
8523
|
-
headers:
|
|
8524
|
-
authorization:
|
|
8644
|
+
headers: t15.Object({
|
|
8645
|
+
authorization: t15.Optional(t15.String())
|
|
8525
8646
|
})
|
|
8526
8647
|
}).post(userinfoRoute, async ({ headers, body }) => {
|
|
8527
8648
|
const token = readUserInfoBearer(headers.authorization) ?? body.access_token;
|
|
@@ -8537,17 +8658,17 @@ var oidcProviderRoutes = (config) => {
|
|
|
8537
8658
|
}
|
|
8538
8659
|
return jsonResponse(result.body, HTTP_OK3);
|
|
8539
8660
|
}, {
|
|
8540
|
-
body:
|
|
8541
|
-
access_token:
|
|
8661
|
+
body: t15.Object({
|
|
8662
|
+
access_token: t15.Optional(t15.String())
|
|
8542
8663
|
}),
|
|
8543
|
-
headers:
|
|
8544
|
-
authorization:
|
|
8664
|
+
headers: t15.Object({
|
|
8665
|
+
authorization: t15.Optional(t15.String())
|
|
8545
8666
|
})
|
|
8546
8667
|
}).get(jwksRoute, () => ({ keys: [toPublicJwk(signingKey)] })).get("/.well-known/openid-configuration", () => discovery).get("/.well-known/oauth-authorization-server", () => discovery);
|
|
8547
8668
|
};
|
|
8548
8669
|
|
|
8549
8670
|
// src/organizations/routes.ts
|
|
8550
|
-
import { Elysia as
|
|
8671
|
+
import { Elysia as Elysia23, t as t16 } from "elysia";
|
|
8551
8672
|
|
|
8552
8673
|
// src/organizations/config.ts
|
|
8553
8674
|
init_constants();
|
|
@@ -8663,7 +8784,7 @@ var organizationRoutes = ({
|
|
|
8663
8784
|
organizationStore,
|
|
8664
8785
|
ownerRoles
|
|
8665
8786
|
}) => {
|
|
8666
|
-
const cookie =
|
|
8787
|
+
const cookie = t16.Cookie({ user_session_id: userSessionIdTypebox });
|
|
8667
8788
|
const requireUser = async (userSessionId, session) => {
|
|
8668
8789
|
const current = await loadSessionFromSource({
|
|
8669
8790
|
authSessionStore,
|
|
@@ -8679,7 +8800,7 @@ var organizationRoutes = ({
|
|
|
8679
8800
|
}
|
|
8680
8801
|
return membership?.status === "active";
|
|
8681
8802
|
};
|
|
8682
|
-
return new
|
|
8803
|
+
return new Elysia23().use(sessionStore()).get(organizationsRoute, async ({
|
|
8683
8804
|
cookie: { user_session_id },
|
|
8684
8805
|
status,
|
|
8685
8806
|
store: { session }
|
|
@@ -8726,9 +8847,9 @@ var organizationRoutes = ({
|
|
|
8726
8847
|
});
|
|
8727
8848
|
return status("OK", { organization });
|
|
8728
8849
|
}, {
|
|
8729
|
-
body:
|
|
8730
|
-
metadata:
|
|
8731
|
-
name:
|
|
8850
|
+
body: t16.Object({
|
|
8851
|
+
metadata: t16.Optional(t16.Record(t16.String(), t16.Unknown())),
|
|
8852
|
+
name: t16.String()
|
|
8732
8853
|
}),
|
|
8733
8854
|
cookie
|
|
8734
8855
|
}).post(`${organizationsRoute}/:organizationId/invitations`, async ({
|
|
@@ -8772,12 +8893,12 @@ var organizationRoutes = ({
|
|
|
8772
8893
|
token
|
|
8773
8894
|
});
|
|
8774
8895
|
}, {
|
|
8775
|
-
body:
|
|
8776
|
-
email:
|
|
8777
|
-
roles:
|
|
8896
|
+
body: t16.Object({
|
|
8897
|
+
email: t16.String(),
|
|
8898
|
+
roles: t16.Optional(t16.Array(t16.String()))
|
|
8778
8899
|
}),
|
|
8779
8900
|
cookie,
|
|
8780
|
-
params:
|
|
8901
|
+
params: t16.Object({ organizationId: t16.String() })
|
|
8781
8902
|
}).get(`${organizationsRoute}/:organizationId/invitations`, async ({
|
|
8782
8903
|
cookie: { user_session_id },
|
|
8783
8904
|
params: { organizationId },
|
|
@@ -8801,7 +8922,7 @@ var organizationRoutes = ({
|
|
|
8801
8922
|
state: invitation.state
|
|
8802
8923
|
}))
|
|
8803
8924
|
});
|
|
8804
|
-
}, { cookie, params:
|
|
8925
|
+
}, { cookie, params: t16.Object({ organizationId: t16.String() }) }).delete(`${organizationsRoute}/:organizationId/invitations/:invitationId`, async ({
|
|
8805
8926
|
cookie: { user_session_id },
|
|
8806
8927
|
params: { invitationId, organizationId },
|
|
8807
8928
|
status,
|
|
@@ -8825,9 +8946,9 @@ var organizationRoutes = ({
|
|
|
8825
8946
|
return status("OK", { revoked: invitationId });
|
|
8826
8947
|
}, {
|
|
8827
8948
|
cookie,
|
|
8828
|
-
params:
|
|
8829
|
-
invitationId:
|
|
8830
|
-
organizationId:
|
|
8949
|
+
params: t16.Object({
|
|
8950
|
+
invitationId: t16.String(),
|
|
8951
|
+
organizationId: t16.String()
|
|
8831
8952
|
})
|
|
8832
8953
|
}).post(`${organizationsRoute}/invitations/accept`, async ({
|
|
8833
8954
|
body: { token },
|
|
@@ -8862,7 +8983,7 @@ var organizationRoutes = ({
|
|
|
8862
8983
|
organizationId: membership.organizationId,
|
|
8863
8984
|
roles: membership.roles
|
|
8864
8985
|
});
|
|
8865
|
-
}, { body:
|
|
8986
|
+
}, { body: t16.Object({ token: t16.String() }), cookie }).get(`${organizationsRoute}/:organizationId/members`, async ({
|
|
8866
8987
|
cookie: { user_session_id },
|
|
8867
8988
|
params: { organizationId },
|
|
8868
8989
|
status,
|
|
@@ -8878,7 +8999,7 @@ var organizationRoutes = ({
|
|
|
8878
8999
|
}
|
|
8879
9000
|
const members = await organizationStore.listMembershipsByOrganization(organizationId);
|
|
8880
9001
|
return status("OK", { members });
|
|
8881
|
-
}, { cookie, params:
|
|
9002
|
+
}, { cookie, params: t16.Object({ organizationId: t16.String() }) }).delete(`${organizationsRoute}/:organizationId/members/:userId`, async ({
|
|
8882
9003
|
cookie: { user_session_id },
|
|
8883
9004
|
params: { organizationId, userId },
|
|
8884
9005
|
status,
|
|
@@ -8902,16 +9023,16 @@ var organizationRoutes = ({
|
|
|
8902
9023
|
return status("OK", { removed: userId });
|
|
8903
9024
|
}, {
|
|
8904
9025
|
cookie,
|
|
8905
|
-
params:
|
|
8906
|
-
organizationId:
|
|
8907
|
-
userId:
|
|
9026
|
+
params: t16.Object({
|
|
9027
|
+
organizationId: t16.String(),
|
|
9028
|
+
userId: t16.String()
|
|
8908
9029
|
})
|
|
8909
9030
|
});
|
|
8910
9031
|
};
|
|
8911
9032
|
|
|
8912
9033
|
// src/passwordless/routes.ts
|
|
8913
9034
|
init_crypto();
|
|
8914
|
-
import { Elysia as
|
|
9035
|
+
import { Elysia as Elysia24, t as t17 } from "elysia";
|
|
8915
9036
|
|
|
8916
9037
|
// src/passwordless/config.ts
|
|
8917
9038
|
init_constants();
|
|
@@ -8947,8 +9068,8 @@ var passwordlessRoutes = ({
|
|
|
8947
9068
|
passwordlessTokenStore,
|
|
8948
9069
|
sessionDurationMs = DEFAULT_PASSWORDLESS_SESSION_TTL_MS
|
|
8949
9070
|
}) => {
|
|
8950
|
-
const cookie =
|
|
8951
|
-
user_session_id:
|
|
9071
|
+
const cookie = t17.Cookie({
|
|
9072
|
+
user_session_id: t17.Optional(userSessionIdTypebox)
|
|
8952
9073
|
});
|
|
8953
9074
|
const completeLogin = async (email, userSessionCookie, session) => {
|
|
8954
9075
|
const existing = await getUserByEmail(email);
|
|
@@ -8972,7 +9093,7 @@ var passwordlessRoutes = ({
|
|
|
8972
9093
|
await onPasswordlessLogin?.({ user, userSessionId });
|
|
8973
9094
|
return userSessionId;
|
|
8974
9095
|
};
|
|
8975
|
-
const magicLink = onSendMagicLink ? new
|
|
9096
|
+
const magicLink = onSendMagicLink ? new Elysia24().use(sessionStore()).post(`${passwordlessRoute}/magic-link`, async ({ body: { email }, status }) => {
|
|
8976
9097
|
const normalizedEmail = email.trim().toLowerCase();
|
|
8977
9098
|
const token = generateSecureToken();
|
|
8978
9099
|
const expiresAt = Date.now() + magicLinkTokenDurationMs;
|
|
@@ -8987,7 +9108,7 @@ var passwordlessRoutes = ({
|
|
|
8987
9108
|
token
|
|
8988
9109
|
});
|
|
8989
9110
|
return status("OK", { status: "magic_link_sent" });
|
|
8990
|
-
}, { body:
|
|
9111
|
+
}, { body: t17.Object({ email: t17.String() }) }).post(`${passwordlessRoute}/magic-link/verify`, async ({
|
|
8991
9112
|
body: { token },
|
|
8992
9113
|
cookie: { user_session_id },
|
|
8993
9114
|
status,
|
|
@@ -9002,8 +9123,8 @@ var passwordlessRoutes = ({
|
|
|
9002
9123
|
return status("Unauthorized", "No account for this email");
|
|
9003
9124
|
}
|
|
9004
9125
|
return status("OK", { status: "authenticated" });
|
|
9005
|
-
}, { body:
|
|
9006
|
-
const otp = onSendOtp ? new
|
|
9126
|
+
}, { body: t17.Object({ token: t17.String() }), cookie }) : new Elysia24;
|
|
9127
|
+
const otp = onSendOtp ? new Elysia24().use(sessionStore()).post(`${passwordlessRoute}/otp`, async ({ body: { email }, status }) => {
|
|
9007
9128
|
const normalizedEmail = email.trim().toLowerCase();
|
|
9008
9129
|
const code = generateOtpCode(otpLength);
|
|
9009
9130
|
const expiresAt = Date.now() + otpDurationMs;
|
|
@@ -9018,7 +9139,7 @@ var passwordlessRoutes = ({
|
|
|
9018
9139
|
expiresAt
|
|
9019
9140
|
});
|
|
9020
9141
|
return status("OK", { status: "otp_sent" });
|
|
9021
|
-
}, { body:
|
|
9142
|
+
}, { body: t17.Object({ email: t17.String() }) }).post(`${passwordlessRoute}/otp/verify`, async ({
|
|
9022
9143
|
body: { code, email },
|
|
9023
9144
|
cookie: { user_session_id },
|
|
9024
9145
|
status,
|
|
@@ -9035,17 +9156,17 @@ var passwordlessRoutes = ({
|
|
|
9035
9156
|
}
|
|
9036
9157
|
return status("OK", { status: "authenticated" });
|
|
9037
9158
|
}, {
|
|
9038
|
-
body:
|
|
9039
|
-
code:
|
|
9040
|
-
email:
|
|
9159
|
+
body: t17.Object({
|
|
9160
|
+
code: t17.String(),
|
|
9161
|
+
email: t17.String()
|
|
9041
9162
|
}),
|
|
9042
9163
|
cookie
|
|
9043
|
-
}) : new
|
|
9044
|
-
return new
|
|
9164
|
+
}) : new Elysia24;
|
|
9165
|
+
return new Elysia24().use(magicLink).use(otp);
|
|
9045
9166
|
};
|
|
9046
9167
|
|
|
9047
9168
|
// src/portal/routes.ts
|
|
9048
|
-
import { Elysia as
|
|
9169
|
+
import { Elysia as Elysia25, t as t18 } from "elysia";
|
|
9049
9170
|
|
|
9050
9171
|
// src/scim/config.ts
|
|
9051
9172
|
init_crypto();
|
|
@@ -9140,7 +9261,7 @@ var portalRoutes = ({
|
|
|
9140
9261
|
}) => {
|
|
9141
9262
|
const loadSession = (authorization) => resolveSetupSession({ authorization, setupSessionStore });
|
|
9142
9263
|
const oidcRedirectUri = (origin, organizationId) => `${origin}${ssoRoute}/oidc/${organizationId}/callback`;
|
|
9143
|
-
return new
|
|
9264
|
+
return new Elysia25().get(`${portalRoute}/session`, async ({ headers, request, status }) => {
|
|
9144
9265
|
const session = await loadSession(headers.authorization);
|
|
9145
9266
|
if (!session) {
|
|
9146
9267
|
return status("Unauthorized", "Invalid or expired setup link");
|
|
@@ -9203,11 +9324,11 @@ var portalRoutes = ({
|
|
|
9203
9324
|
});
|
|
9204
9325
|
return status("OK", { configured: true, type: "saml" });
|
|
9205
9326
|
}, {
|
|
9206
|
-
body:
|
|
9207
|
-
idpEntityId:
|
|
9208
|
-
idpSloUrl:
|
|
9209
|
-
idpSsoUrl:
|
|
9210
|
-
idpX509Cert:
|
|
9327
|
+
body: t18.Object({
|
|
9328
|
+
idpEntityId: t18.String(),
|
|
9329
|
+
idpSloUrl: t18.Optional(t18.String()),
|
|
9330
|
+
idpSsoUrl: t18.String(),
|
|
9331
|
+
idpX509Cert: t18.String()
|
|
9211
9332
|
})
|
|
9212
9333
|
}).put(`${portalRoute}/connection/oidc`, async ({ body, headers, request, status }) => {
|
|
9213
9334
|
const session = await loadSession(headers.authorization);
|
|
@@ -9251,12 +9372,12 @@ var portalRoutes = ({
|
|
|
9251
9372
|
});
|
|
9252
9373
|
return status("OK", { configured: true, type: "oidc" });
|
|
9253
9374
|
}, {
|
|
9254
|
-
body:
|
|
9255
|
-
clientId:
|
|
9256
|
-
clientSecret:
|
|
9257
|
-
issuer:
|
|
9258
|
-
redirectUri:
|
|
9259
|
-
scopes:
|
|
9375
|
+
body: t18.Object({
|
|
9376
|
+
clientId: t18.String(),
|
|
9377
|
+
clientSecret: t18.String(),
|
|
9378
|
+
issuer: t18.String(),
|
|
9379
|
+
redirectUri: t18.Optional(t18.String()),
|
|
9380
|
+
scopes: t18.Optional(t18.Array(t18.String()))
|
|
9260
9381
|
})
|
|
9261
9382
|
}).post(`${portalRoute}/scim/token`, async ({ headers, request, status }) => {
|
|
9262
9383
|
const session = await loadSession(headers.authorization);
|
|
@@ -9287,7 +9408,7 @@ var portalRoutes = ({
|
|
|
9287
9408
|
};
|
|
9288
9409
|
|
|
9289
9410
|
// src/roles/routes.ts
|
|
9290
|
-
import { Elysia as
|
|
9411
|
+
import { Elysia as Elysia26, t as t19 } from "elysia";
|
|
9291
9412
|
|
|
9292
9413
|
// src/roles/config.ts
|
|
9293
9414
|
var DEFAULT_ROLES_ROUTE = "/auth/roles";
|
|
@@ -9322,7 +9443,7 @@ var roleRoutes = ({
|
|
|
9322
9443
|
roleStore,
|
|
9323
9444
|
rolesRoute = DEFAULT_ROLES_ROUTE
|
|
9324
9445
|
}) => {
|
|
9325
|
-
const cookie =
|
|
9446
|
+
const cookie = t19.Cookie({ user_session_id: userSessionIdTypebox });
|
|
9326
9447
|
const requireUser = async (userSessionId, session) => {
|
|
9327
9448
|
const current = await loadSessionFromSource({
|
|
9328
9449
|
authSessionStore,
|
|
@@ -9338,7 +9459,7 @@ var roleRoutes = ({
|
|
|
9338
9459
|
}
|
|
9339
9460
|
return membership?.status === "active";
|
|
9340
9461
|
};
|
|
9341
|
-
return new
|
|
9462
|
+
return new Elysia26().use(sessionStore()).get(`${rolesRoute}/:organizationId`, async ({
|
|
9342
9463
|
cookie: { user_session_id },
|
|
9343
9464
|
params: { organizationId },
|
|
9344
9465
|
status,
|
|
@@ -9356,7 +9477,7 @@ var roleRoutes = ({
|
|
|
9356
9477
|
roleStore.listRoles()
|
|
9357
9478
|
]);
|
|
9358
9479
|
return status("OK", { roles: [...scoped, ...global] });
|
|
9359
|
-
}, { cookie, params:
|
|
9480
|
+
}, { cookie, params: t19.Object({ organizationId: t19.String() }) }).put(`${rolesRoute}/:organizationId/members/:userId`, async ({
|
|
9360
9481
|
body: { roles },
|
|
9361
9482
|
cookie: { user_session_id },
|
|
9362
9483
|
params: { organizationId, userId },
|
|
@@ -9389,11 +9510,11 @@ var roleRoutes = ({
|
|
|
9389
9510
|
await onRolesAssigned?.({ organizationId, roles, userId });
|
|
9390
9511
|
return status("OK", { roles: updated.roles });
|
|
9391
9512
|
}, {
|
|
9392
|
-
body:
|
|
9513
|
+
body: t19.Object({ roles: t19.Array(t19.String()) }),
|
|
9393
9514
|
cookie,
|
|
9394
|
-
params:
|
|
9395
|
-
organizationId:
|
|
9396
|
-
userId:
|
|
9515
|
+
params: t19.Object({
|
|
9516
|
+
organizationId: t19.String(),
|
|
9517
|
+
userId: t19.String()
|
|
9397
9518
|
})
|
|
9398
9519
|
});
|
|
9399
9520
|
};
|
|
@@ -9561,7 +9682,7 @@ var resolveProviderClientConfiguration = ({
|
|
|
9561
9682
|
|
|
9562
9683
|
// src/routes/authorize.ts
|
|
9563
9684
|
init_constants();
|
|
9564
|
-
import { Elysia as
|
|
9685
|
+
import { Elysia as Elysia27, t as t20 } from "elysia";
|
|
9565
9686
|
var parseReferer = (headerReferer) => {
|
|
9566
9687
|
if (!headerReferer)
|
|
9567
9688
|
return "/";
|
|
@@ -9583,7 +9704,7 @@ var authorize = ({
|
|
|
9583
9704
|
onAuthorizeError
|
|
9584
9705
|
}) => {
|
|
9585
9706
|
const secure = resolveCookieSecure(cookieSecure);
|
|
9586
|
-
return new
|
|
9707
|
+
return new Elysia27().get(authorizeRoute, async ({
|
|
9587
9708
|
status,
|
|
9588
9709
|
redirect,
|
|
9589
9710
|
cookie: {
|
|
@@ -9700,15 +9821,15 @@ var authorize = ({
|
|
|
9700
9821
|
return status("Internal Server Error", "Failed to create authorization URL");
|
|
9701
9822
|
}
|
|
9702
9823
|
}, {
|
|
9703
|
-
cookie:
|
|
9824
|
+
cookie: t20.Cookie({
|
|
9704
9825
|
auth_client: authClientOption,
|
|
9705
9826
|
auth_intent: authIntentOption,
|
|
9706
|
-
auth_provider:
|
|
9827
|
+
auth_provider: t20.Optional(authProviderOption)
|
|
9707
9828
|
}),
|
|
9708
|
-
params:
|
|
9829
|
+
params: t20.Object({
|
|
9709
9830
|
provider: authProviderOption
|
|
9710
9831
|
}),
|
|
9711
|
-
query:
|
|
9832
|
+
query: t20.Object({
|
|
9712
9833
|
client: authClientOption,
|
|
9713
9834
|
intent: authIntentOption
|
|
9714
9835
|
})
|
|
@@ -9716,7 +9837,7 @@ var authorize = ({
|
|
|
9716
9837
|
};
|
|
9717
9838
|
|
|
9718
9839
|
// src/routes/callback.ts
|
|
9719
|
-
import { Elysia as
|
|
9840
|
+
import { Elysia as Elysia28, t as t21 } from "elysia";
|
|
9720
9841
|
|
|
9721
9842
|
// src/errors.ts
|
|
9722
9843
|
class AuthIdentityConflictError extends Error {
|
|
@@ -9739,7 +9860,7 @@ var callback = ({
|
|
|
9739
9860
|
onLinkIdentityConflict,
|
|
9740
9861
|
onLinkConnector,
|
|
9741
9862
|
onCallbackError
|
|
9742
|
-
}) => new
|
|
9863
|
+
}) => new Elysia28().use(sessionStore()).get(callbackRoute, async ({
|
|
9743
9864
|
status,
|
|
9744
9865
|
redirect,
|
|
9745
9866
|
store: { session, unregisteredSession },
|
|
@@ -9874,25 +9995,25 @@ var callback = ({
|
|
|
9874
9995
|
}
|
|
9875
9996
|
return redirect(originUrl);
|
|
9876
9997
|
}), {
|
|
9877
|
-
cookie:
|
|
9998
|
+
cookie: t21.Cookie({
|
|
9878
9999
|
auth_client: authClientOption,
|
|
9879
10000
|
auth_intent: authIntentOption,
|
|
9880
|
-
auth_provider:
|
|
9881
|
-
code_verifier:
|
|
9882
|
-
origin_url:
|
|
9883
|
-
state:
|
|
9884
|
-
user_session_id:
|
|
10001
|
+
auth_provider: t21.Optional(authProviderOption),
|
|
10002
|
+
code_verifier: t21.Optional(t21.String()),
|
|
10003
|
+
origin_url: t21.Optional(t21.String()),
|
|
10004
|
+
state: t21.Optional(t21.String()),
|
|
10005
|
+
user_session_id: t21.Optional(userSessionIdTypebox)
|
|
9885
10006
|
})
|
|
9886
10007
|
});
|
|
9887
10008
|
|
|
9888
10009
|
// src/routes/profile.ts
|
|
9889
|
-
import { Elysia as
|
|
10010
|
+
import { Elysia as Elysia29, t as t22 } from "elysia";
|
|
9890
10011
|
var profile = ({
|
|
9891
10012
|
clientProviders,
|
|
9892
10013
|
profileRoute = "/oauth2/profile",
|
|
9893
10014
|
onProfileSuccess,
|
|
9894
10015
|
onProfileError
|
|
9895
|
-
}) => new
|
|
10016
|
+
}) => new Elysia29().use(sessionStore()).get(profileRoute, async ({
|
|
9896
10017
|
status,
|
|
9897
10018
|
store: { session },
|
|
9898
10019
|
cookie: { user_session_id, auth_provider, auth_client }
|
|
@@ -9942,7 +10063,7 @@ var profile = ({
|
|
|
9942
10063
|
return err instanceof Error ? status("Internal Server Error", `${err.message} - ${err.stack ?? ""}`) : status("Internal Server Error", `Failed to validate authorization code: Unknown status: ${err}`);
|
|
9943
10064
|
}
|
|
9944
10065
|
}, {
|
|
9945
|
-
cookie:
|
|
10066
|
+
cookie: t22.Cookie({
|
|
9946
10067
|
auth_client: authClientOption,
|
|
9947
10068
|
auth_provider: authProviderOption,
|
|
9948
10069
|
user_session_id: userSessionIdTypebox
|
|
@@ -9951,7 +10072,7 @@ var profile = ({
|
|
|
9951
10072
|
|
|
9952
10073
|
// src/routes/refresh.ts
|
|
9953
10074
|
init_constants();
|
|
9954
|
-
import { Elysia as
|
|
10075
|
+
import { Elysia as Elysia30, t as t23 } from "elysia";
|
|
9955
10076
|
var refresh = ({
|
|
9956
10077
|
authSessionStore,
|
|
9957
10078
|
clientProviders,
|
|
@@ -9959,7 +10080,7 @@ var refresh = ({
|
|
|
9959
10080
|
onRefreshSuccess,
|
|
9960
10081
|
onRefreshError,
|
|
9961
10082
|
sessionDurationMs = MILLISECONDS_IN_A_DAY
|
|
9962
|
-
}) => new
|
|
10083
|
+
}) => new Elysia30().use(sessionStore()).post(refreshRoute, async ({
|
|
9963
10084
|
status,
|
|
9964
10085
|
store: { session },
|
|
9965
10086
|
cookie: { user_session_id, auth_provider, auth_client }
|
|
@@ -10028,7 +10149,7 @@ var refresh = ({
|
|
|
10028
10149
|
return status("Internal Server Error", "Failed to refresh token");
|
|
10029
10150
|
}
|
|
10030
10151
|
}, {
|
|
10031
|
-
cookie:
|
|
10152
|
+
cookie: t23.Cookie({
|
|
10032
10153
|
auth_client: authClientOption,
|
|
10033
10154
|
auth_provider: authProviderOption,
|
|
10034
10155
|
user_session_id: userSessionIdTypebox
|
|
@@ -10036,14 +10157,14 @@ var refresh = ({
|
|
|
10036
10157
|
});
|
|
10037
10158
|
|
|
10038
10159
|
// src/routes/revoke.ts
|
|
10039
|
-
import { Elysia as
|
|
10160
|
+
import { Elysia as Elysia31, t as t24 } from "elysia";
|
|
10040
10161
|
var revoke = ({
|
|
10041
10162
|
authSessionStore,
|
|
10042
10163
|
clientProviders,
|
|
10043
10164
|
revokeRoute = "/oauth2/revocation",
|
|
10044
10165
|
onRevocationSuccess,
|
|
10045
10166
|
onRevocationError
|
|
10046
|
-
}) => new
|
|
10167
|
+
}) => new Elysia31().use(sessionStore()).post(revokeRoute, async ({
|
|
10047
10168
|
status,
|
|
10048
10169
|
store: { session },
|
|
10049
10170
|
cookie: { user_session_id, auth_provider, auth_client }
|
|
@@ -10108,7 +10229,7 @@ var revoke = ({
|
|
|
10108
10229
|
return status("Internal Server Error", "Failed to revoke token");
|
|
10109
10230
|
}
|
|
10110
10231
|
}, {
|
|
10111
|
-
cookie:
|
|
10232
|
+
cookie: t24.Cookie({
|
|
10112
10233
|
auth_client: authClientOption,
|
|
10113
10234
|
auth_provider: authProviderOption,
|
|
10114
10235
|
user_session_id: userSessionIdTypebox
|
|
@@ -10116,12 +10237,12 @@ var revoke = ({
|
|
|
10116
10237
|
});
|
|
10117
10238
|
|
|
10118
10239
|
// src/routes/sessions.ts
|
|
10119
|
-
import { Elysia as
|
|
10240
|
+
import { Elysia as Elysia32, t as t25 } from "elysia";
|
|
10120
10241
|
var sessionRoutes = ({
|
|
10121
10242
|
authSessionStore,
|
|
10122
10243
|
getUserId,
|
|
10123
10244
|
sessionsRoute = "/auth/sessions"
|
|
10124
|
-
}) => new
|
|
10245
|
+
}) => new Elysia32().use(sessionStore()).get(sessionsRoute, async ({
|
|
10125
10246
|
cookie: { user_session_id },
|
|
10126
10247
|
status,
|
|
10127
10248
|
store: { session }
|
|
@@ -10149,7 +10270,7 @@ var sessionRoutes = ({
|
|
|
10149
10270
|
id: entry.id
|
|
10150
10271
|
}));
|
|
10151
10272
|
return status("OK", { sessions: list });
|
|
10152
|
-
}, { cookie:
|
|
10273
|
+
}, { cookie: t25.Cookie({ user_session_id: userSessionIdTypebox }) }).delete(`${sessionsRoute}/:id`, async ({
|
|
10153
10274
|
cookie: { user_session_id },
|
|
10154
10275
|
params: { id },
|
|
10155
10276
|
status,
|
|
@@ -10176,34 +10297,12 @@ var sessionRoutes = ({
|
|
|
10176
10297
|
await authSessionStore.removeSession(id);
|
|
10177
10298
|
return status("OK", { revoked: id });
|
|
10178
10299
|
}, {
|
|
10179
|
-
cookie:
|
|
10180
|
-
params:
|
|
10300
|
+
cookie: t25.Cookie({ user_session_id: userSessionIdTypebox }),
|
|
10301
|
+
params: t25.Object({ id: t25.String() })
|
|
10181
10302
|
});
|
|
10182
10303
|
|
|
10183
|
-
// src/routes/stepUp.ts
|
|
10184
|
-
import { Elysia as Elysia29, t as t25 } from "elysia";
|
|
10185
|
-
var stepUpPlugin = ({
|
|
10186
|
-
authSessionStore
|
|
10187
|
-
} = {}) => new Elysia29().use(sessionStore()).guard({ cookie: t25.Cookie({ user_session_id: userSessionIdTypebox }) }).derive(({ store: { session }, cookie: { user_session_id }, status }) => ({
|
|
10188
|
-
requireRecentAuth: (maxAgeMs, handleAuth, handleAuthFail) => loadSessionFromSource({
|
|
10189
|
-
authSessionStore,
|
|
10190
|
-
session,
|
|
10191
|
-
userSessionId: user_session_id.value
|
|
10192
|
-
}).then((userSession) => {
|
|
10193
|
-
const authenticatedAt = userSession?.authenticatedAt;
|
|
10194
|
-
const isRecent = authenticatedAt !== undefined && Date.now() - authenticatedAt <= maxAgeMs;
|
|
10195
|
-
if (!userSession || !isRecent) {
|
|
10196
|
-
return handleAuthFail?.({
|
|
10197
|
-
code: "Unauthorized",
|
|
10198
|
-
message: "Recent authentication required"
|
|
10199
|
-
}) ?? status("Unauthorized", "Recent authentication required");
|
|
10200
|
-
}
|
|
10201
|
-
return handleAuth(userSession.user);
|
|
10202
|
-
})
|
|
10203
|
-
})).as("global");
|
|
10204
|
-
|
|
10205
10304
|
// src/routes/signout.ts
|
|
10206
|
-
import { Elysia as
|
|
10305
|
+
import { Elysia as Elysia33, t as t26 } from "elysia";
|
|
10207
10306
|
var sessionForSignOut = ({
|
|
10208
10307
|
authSessionStore,
|
|
10209
10308
|
currentSession,
|
|
@@ -10233,7 +10332,7 @@ var signout = ({
|
|
|
10233
10332
|
authSessionStore,
|
|
10234
10333
|
signoutRoute = "/oauth2/signout",
|
|
10235
10334
|
onSignOut
|
|
10236
|
-
}) => new
|
|
10335
|
+
}) => new Elysia33().use(sessionStore()).delete(signoutRoute, async ({
|
|
10237
10336
|
status,
|
|
10238
10337
|
store: { session },
|
|
10239
10338
|
cookie: { user_session_id, auth_provider }
|
|
@@ -10280,12 +10379,12 @@ var signout = ({
|
|
|
10280
10379
|
});
|
|
10281
10380
|
|
|
10282
10381
|
// src/routes/userStatus.ts
|
|
10283
|
-
import { Elysia as
|
|
10382
|
+
import { Elysia as Elysia34, t as t27 } from "elysia";
|
|
10284
10383
|
var userStatus = ({
|
|
10285
10384
|
authSessionStore,
|
|
10286
10385
|
statusRoute = "/oauth2/status",
|
|
10287
10386
|
onStatus
|
|
10288
|
-
}) => new
|
|
10387
|
+
}) => new Elysia34().use(sessionStore()).get(statusRoute, async ({ status, cookie: { user_session_id }, store: { session } }) => {
|
|
10289
10388
|
const { user, impersonator, error } = await getStatusFromSource({
|
|
10290
10389
|
authSessionStore,
|
|
10291
10390
|
session,
|
|
@@ -10303,7 +10402,7 @@ var userStatus = ({
|
|
|
10303
10402
|
}, { cookie: t27.Cookie({ user_session_id: userSessionIdTypebox }) });
|
|
10304
10403
|
|
|
10305
10404
|
// src/scim/routes.ts
|
|
10306
|
-
import { Elysia as
|
|
10405
|
+
import { Elysia as Elysia35, t as t28 } from "elysia";
|
|
10307
10406
|
|
|
10308
10407
|
// src/scim/serialize.ts
|
|
10309
10408
|
var USER_SCHEMA = "urn:ietf:params:scim:schemas:core:2.0:User";
|
|
@@ -10776,7 +10875,7 @@ var scimRoutes = ({
|
|
|
10776
10875
|
const resourceTypesLocation = (requestUrl) => `${new URL(requestUrl).origin}${scimRoute}/ResourceTypes`;
|
|
10777
10876
|
const usersEndpoint = `${scimRoute}/Users`;
|
|
10778
10877
|
const groupsEndpoint = `${scimRoute}/Groups`;
|
|
10779
|
-
return new
|
|
10878
|
+
return new Elysia35().onParse(({ request }, contentType) => contentType === SCIM_CONTENT_TYPE2 ? request.json() : undefined).get(spcRoute, async ({ headers, request }) => {
|
|
10780
10879
|
const organizationId = await resolveScimOrganization(scimTokenStore, headers.authorization);
|
|
10781
10880
|
if (organizationId === undefined)
|
|
10782
10881
|
return unauthorized();
|
|
@@ -10968,7 +11067,7 @@ var scimRoutes = ({
|
|
|
10968
11067
|
|
|
10969
11068
|
// src/session/cleanup.ts
|
|
10970
11069
|
init_constants();
|
|
10971
|
-
import { Elysia as
|
|
11070
|
+
import { Elysia as Elysia36 } from "elysia";
|
|
10972
11071
|
var sessionCleanup = ({
|
|
10973
11072
|
authSessionStore,
|
|
10974
11073
|
cleanupIntervalMs = MILLISECONDS_IN_AN_HOUR,
|
|
@@ -10976,7 +11075,7 @@ var sessionCleanup = ({
|
|
|
10976
11075
|
onSessionCleanup
|
|
10977
11076
|
}) => {
|
|
10978
11077
|
let intervalId = null;
|
|
10979
|
-
return new
|
|
11078
|
+
return new Elysia36({ name: "sessionCleanup" }).use(sessionStore()).onStart(({ store: { session, unregisteredSession } }) => {
|
|
10980
11079
|
intervalId = setInterval(async () => {
|
|
10981
11080
|
await performCleanup({
|
|
10982
11081
|
authSessionStore,
|
|
@@ -11204,7 +11303,7 @@ var performCleanup = async ({
|
|
|
11204
11303
|
};
|
|
11205
11304
|
|
|
11206
11305
|
// src/sso/discoveryRoute.ts
|
|
11207
|
-
import { Elysia as
|
|
11306
|
+
import { Elysia as Elysia37, t as t29 } from "elysia";
|
|
11208
11307
|
var emailDomain = (email) => {
|
|
11209
11308
|
const atIndex = email.lastIndexOf("@");
|
|
11210
11309
|
if (atIndex === -1)
|
|
@@ -11217,7 +11316,7 @@ var ssoDiscoveryRoute = ({
|
|
|
11217
11316
|
ssoRoute = DEFAULT_SSO_ROUTE
|
|
11218
11317
|
}) => {
|
|
11219
11318
|
const discoveryRoute = `${ssoRoute}/authorize`;
|
|
11220
|
-
return new
|
|
11319
|
+
return new Elysia37().get(discoveryRoute, async ({ query: { email }, redirect, status }) => {
|
|
11221
11320
|
if (!isNonEmptyString(email)) {
|
|
11222
11321
|
return status("Bad Request", 'An "email" query parameter is required');
|
|
11223
11322
|
}
|
|
@@ -11239,7 +11338,7 @@ var ssoDiscoveryRoute = ({
|
|
|
11239
11338
|
|
|
11240
11339
|
// src/sso/oidcRoutes.ts
|
|
11241
11340
|
init_constants();
|
|
11242
|
-
import { Elysia as
|
|
11341
|
+
import { Elysia as Elysia38, t as t30 } from "elysia";
|
|
11243
11342
|
var makeSsoCookieOptions = (secure) => ({
|
|
11244
11343
|
httpOnly: true,
|
|
11245
11344
|
maxAge: COOKIE_DURATION,
|
|
@@ -11278,7 +11377,7 @@ var oidcSsoRoutes = ({
|
|
|
11278
11377
|
const ssoCookieOptions = makeSsoCookieOptions(resolveCookieSecure(cookieSecure));
|
|
11279
11378
|
const authorizeRoute = `${ssoRoute}/oidc/:organizationId/authorize`;
|
|
11280
11379
|
const callbackRoute = `${ssoRoute}/oidc/:organizationId/callback`;
|
|
11281
|
-
return new
|
|
11380
|
+
return new Elysia38().use(sessionStore()).get(authorizeRoute, async ({
|
|
11282
11381
|
cookie: {
|
|
11283
11382
|
sso_nonce,
|
|
11284
11383
|
sso_organization,
|
|
@@ -11404,7 +11503,7 @@ var oidcSsoRoutes = ({
|
|
|
11404
11503
|
};
|
|
11405
11504
|
|
|
11406
11505
|
// src/sso/samlRoutes.ts
|
|
11407
|
-
import { Elysia as
|
|
11506
|
+
import { Elysia as Elysia39, t as t31 } from "elysia";
|
|
11408
11507
|
var toLocalPath = (value) => {
|
|
11409
11508
|
if (value === undefined || value.length === 0)
|
|
11410
11509
|
return "/";
|
|
@@ -11454,7 +11553,7 @@ var samlSsoRoutes = ({
|
|
|
11454
11553
|
const target = authSessionStore ? compatibilityLayer.session : inMemorySession;
|
|
11455
11554
|
return target[userSessionId]?.samlLogout;
|
|
11456
11555
|
};
|
|
11457
|
-
return new
|
|
11556
|
+
return new Elysia39().use(sessionStore()).get(authorizeRoute, async ({
|
|
11458
11557
|
headers,
|
|
11459
11558
|
params: { organizationId },
|
|
11460
11559
|
redirect,
|
|
@@ -11676,7 +11775,7 @@ var samlSsoRoutes = ({
|
|
|
11676
11775
|
|
|
11677
11776
|
// src/webauthn/routes.ts
|
|
11678
11777
|
init_constants();
|
|
11679
|
-
import { Elysia as
|
|
11778
|
+
import { Elysia as Elysia40, t as t32 } from "elysia";
|
|
11680
11779
|
|
|
11681
11780
|
// src/webauthn/config.ts
|
|
11682
11781
|
init_constants();
|
|
@@ -11718,7 +11817,7 @@ var webauthnRoutes = ({
|
|
|
11718
11817
|
secure,
|
|
11719
11818
|
value: challenge
|
|
11720
11819
|
});
|
|
11721
|
-
return new
|
|
11820
|
+
return new Elysia40().use(sessionStore()).post(`${webauthnRoute}/register/options`, async ({
|
|
11722
11821
|
cookie: { user_session_id, webauthn_challenge },
|
|
11723
11822
|
status,
|
|
11724
11823
|
store: { session }
|
|
@@ -23488,13 +23587,12 @@ var createLinkedProviderCredentialResolver = ({
|
|
|
23488
23587
|
},
|
|
23489
23588
|
resolveCredential: async (input) => {
|
|
23490
23589
|
const bindings = sortNewestFirst(await bindingStore.listBindingsByOwner(input.ownerRef)).filter((binding) => binding.connectorProvider === input.connectorProvider && isBindingUsable(binding) && (input.bindingId === undefined || binding.id === input.bindingId) && (input.externalAccountId === undefined || binding.externalAccountId === input.externalAccountId));
|
|
23491
|
-
|
|
23492
|
-
const credential = await
|
|
23493
|
-
if (credential)
|
|
23590
|
+
return bindings.reduce(async (pendingCredential, binding) => {
|
|
23591
|
+
const credential = await pendingCredential;
|
|
23592
|
+
if (credential)
|
|
23494
23593
|
return credential;
|
|
23495
|
-
|
|
23496
|
-
}
|
|
23497
|
-
return null;
|
|
23594
|
+
return resolveBindingCredential(grantStore, binding, input);
|
|
23595
|
+
}, Promise.resolve(null));
|
|
23498
23596
|
}
|
|
23499
23597
|
});
|
|
23500
23598
|
// src/linkedProviders/oauthResolver.ts
|
|
@@ -23597,6 +23695,111 @@ var createOAuthLinkedProviderCredentialResolver = async ({
|
|
|
23597
23695
|
}
|
|
23598
23696
|
});
|
|
23599
23697
|
};
|
|
23698
|
+
// src/linkedProviders/oauthAccountResolver.ts
|
|
23699
|
+
var bindingId = (accountId) => `oauth-account:${accountId}`;
|
|
23700
|
+
var accountIdFromBinding = (id) => {
|
|
23701
|
+
const prefix = "oauth-account:";
|
|
23702
|
+
return id.startsWith(prefix) ? id.slice(prefix.length) : null;
|
|
23703
|
+
};
|
|
23704
|
+
var toGrant = (account) => ({
|
|
23705
|
+
accessTokenCiphertext: account.accessToken,
|
|
23706
|
+
authProviderKey: account.authProviderKey,
|
|
23707
|
+
createdAt: account.createdAt,
|
|
23708
|
+
expiresAt: account.expiresAt,
|
|
23709
|
+
grantedScopes: [...account.grantedScopes],
|
|
23710
|
+
id: account.id,
|
|
23711
|
+
metadata: account.metadata,
|
|
23712
|
+
ownerRef: account.ownerRef,
|
|
23713
|
+
providerFamily: account.authProviderKey,
|
|
23714
|
+
providerSubject: account.providerSubject,
|
|
23715
|
+
refreshTokenCiphertext: account.refreshToken,
|
|
23716
|
+
status: account.status,
|
|
23717
|
+
tokenType: account.tokenType,
|
|
23718
|
+
updatedAt: account.updatedAt
|
|
23719
|
+
});
|
|
23720
|
+
var toBinding = (account) => ({
|
|
23721
|
+
availableScopes: [...account.grantedScopes],
|
|
23722
|
+
connectorProvider: account.authProviderKey,
|
|
23723
|
+
createdAt: account.createdAt,
|
|
23724
|
+
externalAccountId: account.providerSubject,
|
|
23725
|
+
externalAccountType: "user",
|
|
23726
|
+
grantId: account.id,
|
|
23727
|
+
id: bindingId(account.id),
|
|
23728
|
+
metadata: account.metadata,
|
|
23729
|
+
status: account.status === "revoked" || account.status === "error" ? "disconnected" : "active",
|
|
23730
|
+
updatedAt: account.updatedAt
|
|
23731
|
+
});
|
|
23732
|
+
var accountWithGrant = (account, grant) => ({
|
|
23733
|
+
...account,
|
|
23734
|
+
accessToken: grant.accessTokenCiphertext,
|
|
23735
|
+
authProviderKey: grant.authProviderKey,
|
|
23736
|
+
expiresAt: grant.expiresAt,
|
|
23737
|
+
grantedScopes: [...grant.grantedScopes],
|
|
23738
|
+
metadata: grant.metadata,
|
|
23739
|
+
ownerRef: grant.ownerRef,
|
|
23740
|
+
providerSubject: grant.providerSubject,
|
|
23741
|
+
refreshToken: grant.refreshTokenCiphertext,
|
|
23742
|
+
status: grant.status,
|
|
23743
|
+
tokenType: grant.tokenType,
|
|
23744
|
+
updatedAt: grant.updatedAt
|
|
23745
|
+
});
|
|
23746
|
+
var accountStatusForBinding = (account, binding) => {
|
|
23747
|
+
if (binding.status === "disconnected")
|
|
23748
|
+
return "revoked";
|
|
23749
|
+
if (binding.status === "restricted")
|
|
23750
|
+
return "error";
|
|
23751
|
+
return account.status;
|
|
23752
|
+
};
|
|
23753
|
+
var createOAuthAccountLinkedProviderCredentialResolver = async ({
|
|
23754
|
+
accountStore,
|
|
23755
|
+
now,
|
|
23756
|
+
providersConfiguration
|
|
23757
|
+
}) => {
|
|
23758
|
+
const grantStore = {
|
|
23759
|
+
getGrant: async (id) => {
|
|
23760
|
+
const account = await accountStore.getAccount(id);
|
|
23761
|
+
return account ? toGrant(account) : undefined;
|
|
23762
|
+
},
|
|
23763
|
+
listGrantsByOwner: async (ownerRef) => (await accountStore.listAccountsByOwner(ownerRef)).map(toGrant),
|
|
23764
|
+
saveGrant: async (grant) => {
|
|
23765
|
+
const account = await accountStore.getAccount(grant.id);
|
|
23766
|
+
if (!account)
|
|
23767
|
+
throw new Error("OAuth linked account is unavailable");
|
|
23768
|
+
await accountStore.saveAccount(accountWithGrant(account, grant));
|
|
23769
|
+
}
|
|
23770
|
+
};
|
|
23771
|
+
const bindingStore = {
|
|
23772
|
+
getBinding: async (id) => {
|
|
23773
|
+
const accountId = accountIdFromBinding(id);
|
|
23774
|
+
if (!accountId)
|
|
23775
|
+
return;
|
|
23776
|
+
const account = await accountStore.getAccount(accountId);
|
|
23777
|
+
return account ? toBinding(account) : undefined;
|
|
23778
|
+
},
|
|
23779
|
+
listBindingsByGrant: async (grantId) => {
|
|
23780
|
+
const account = await accountStore.getAccount(grantId);
|
|
23781
|
+
return account ? [toBinding(account)] : [];
|
|
23782
|
+
},
|
|
23783
|
+
listBindingsByOwner: async (ownerRef) => (await accountStore.listAccountsByOwner(ownerRef)).map(toBinding),
|
|
23784
|
+
saveBinding: async (binding) => {
|
|
23785
|
+
const account = await accountStore.getAccount(binding.grantId);
|
|
23786
|
+
if (!account)
|
|
23787
|
+
throw new Error("OAuth linked account is unavailable");
|
|
23788
|
+
await accountStore.saveAccount({
|
|
23789
|
+
...account,
|
|
23790
|
+
metadata: binding.metadata,
|
|
23791
|
+
status: accountStatusForBinding(account, binding),
|
|
23792
|
+
updatedAt: binding.updatedAt
|
|
23793
|
+
});
|
|
23794
|
+
}
|
|
23795
|
+
};
|
|
23796
|
+
return createOAuthLinkedProviderCredentialResolver({
|
|
23797
|
+
bindingStore,
|
|
23798
|
+
grantStore,
|
|
23799
|
+
...now ? { now } : {},
|
|
23800
|
+
providersConfiguration
|
|
23801
|
+
});
|
|
23802
|
+
};
|
|
23600
23803
|
// src/linkedProviders/neonStores.ts
|
|
23601
23804
|
var linkedProviderBindingsTable = pgTable("linked_provider_bindings", {
|
|
23602
23805
|
available_scopes: jsonb("available_scopes").$type().notNull().default([]),
|
|
@@ -23638,7 +23841,7 @@ var linkedProviderGrantsTable = pgTable("linked_provider_grants", {
|
|
|
23638
23841
|
});
|
|
23639
23842
|
var toTimestamp = (value) => value === undefined ? null : new Date(value);
|
|
23640
23843
|
var fromTimestamp = (value) => value === null ? undefined : value.getTime();
|
|
23641
|
-
var
|
|
23844
|
+
var toGrant2 = (row) => ({
|
|
23642
23845
|
accessTokenCiphertext: row.access_token_ciphertext ?? undefined,
|
|
23643
23846
|
authProviderKey: row.auth_provider_key,
|
|
23644
23847
|
createdAt: row.created_at.getTime(),
|
|
@@ -23656,7 +23859,7 @@ var toGrant = (row) => ({
|
|
|
23656
23859
|
tokenType: row.token_type ?? undefined,
|
|
23657
23860
|
updatedAt: row.updated_at.getTime()
|
|
23658
23861
|
});
|
|
23659
|
-
var
|
|
23862
|
+
var toBinding2 = (row) => ({
|
|
23660
23863
|
availableScopes: row.available_scopes ?? [],
|
|
23661
23864
|
capabilities: row.capabilities ?? undefined,
|
|
23662
23865
|
connectorProvider: row.connector_provider,
|
|
@@ -23675,15 +23878,15 @@ var toBinding = (row) => ({
|
|
|
23675
23878
|
var createNeonLinkedProviderBindingStore = (db) => ({
|
|
23676
23879
|
getBinding: async (id) => {
|
|
23677
23880
|
const [row] = await db.select().from(linkedProviderBindingsTable).where(eq(linkedProviderBindingsTable.id, id)).limit(1);
|
|
23678
|
-
return row ?
|
|
23881
|
+
return row ? toBinding2(row) : undefined;
|
|
23679
23882
|
},
|
|
23680
23883
|
listBindingsByGrant: async (grantId) => {
|
|
23681
23884
|
const rows = await db.select().from(linkedProviderBindingsTable).where(eq(linkedProviderBindingsTable.grant_id, grantId)).orderBy(desc(linkedProviderBindingsTable.updated_at));
|
|
23682
|
-
return rows.map(
|
|
23885
|
+
return rows.map(toBinding2);
|
|
23683
23886
|
},
|
|
23684
23887
|
listBindingsByOwner: async (ownerRef) => {
|
|
23685
23888
|
const rows = await db.select({ binding: linkedProviderBindingsTable }).from(linkedProviderBindingsTable).innerJoin(linkedProviderGrantsTable, eq(linkedProviderBindingsTable.grant_id, linkedProviderGrantsTable.id)).where(eq(linkedProviderGrantsTable.owner_ref, ownerRef)).orderBy(desc(linkedProviderBindingsTable.updated_at));
|
|
23686
|
-
return rows.map(({ binding }) =>
|
|
23889
|
+
return rows.map(({ binding }) => toBinding2(binding));
|
|
23687
23890
|
},
|
|
23688
23891
|
removeBinding: async (id) => {
|
|
23689
23892
|
await db.delete(linkedProviderBindingsTable).where(eq(linkedProviderBindingsTable.id, id));
|
|
@@ -23726,11 +23929,11 @@ var createNeonLinkedProviderBindingStore = (db) => ({
|
|
|
23726
23929
|
var createNeonLinkedProviderGrantStore = (db) => ({
|
|
23727
23930
|
getGrant: async (id) => {
|
|
23728
23931
|
const [row] = await db.select().from(linkedProviderGrantsTable).where(eq(linkedProviderGrantsTable.id, id)).limit(1);
|
|
23729
|
-
return row ?
|
|
23932
|
+
return row ? toGrant2(row) : undefined;
|
|
23730
23933
|
},
|
|
23731
23934
|
listGrantsByOwner: async (ownerRef) => {
|
|
23732
23935
|
const rows = await db.select().from(linkedProviderGrantsTable).where(eq(linkedProviderGrantsTable.owner_ref, ownerRef)).orderBy(desc(linkedProviderGrantsTable.updated_at));
|
|
23733
|
-
return rows.map(
|
|
23936
|
+
return rows.map(toGrant2);
|
|
23734
23937
|
},
|
|
23735
23938
|
removeGrant: async (id) => {
|
|
23736
23939
|
await db.delete(linkedProviderBindingsTable).where(eq(linkedProviderBindingsTable.grant_id, id));
|
|
@@ -23822,7 +24025,7 @@ var createInMemoryLinkedProviderStores = (input = {}) => {
|
|
|
23822
24025
|
listGrantsByOwner: async (ownerRef) => [...grants.values()].filter((grant) => grant.ownerRef === ownerRef).map(cloneGrant),
|
|
23823
24026
|
removeGrant: async (id) => {
|
|
23824
24027
|
grants.delete(id);
|
|
23825
|
-
[...bindings.entries()].filter(([, binding]) => binding.grantId === id).forEach(([
|
|
24028
|
+
[...bindings.entries()].filter(([, binding]) => binding.grantId === id).forEach(([bindingId2]) => bindings.delete(bindingId2));
|
|
23826
24029
|
},
|
|
23827
24030
|
saveGrant: async (grant) => {
|
|
23828
24031
|
grants.set(grant.id, cloneGrant(grant));
|
|
@@ -25052,7 +25255,7 @@ var createInMemoryCredentialOfferStore = () => {
|
|
|
25052
25255
|
};
|
|
25053
25256
|
};
|
|
25054
25257
|
// src/oidc/vciRoutes.ts
|
|
25055
|
-
import { Elysia as
|
|
25258
|
+
import { Elysia as Elysia41, t as t33 } from "elysia";
|
|
25056
25259
|
var HTTP_OK4 = 200;
|
|
25057
25260
|
var HTTP_BAD_REQUEST4 = 400;
|
|
25058
25261
|
var HTTP_UNAUTHORIZED5 = 401;
|
|
@@ -25077,7 +25280,7 @@ var vciRoutes = ({
|
|
|
25077
25280
|
const credentialRoute = `${vciRoute}/credential`;
|
|
25078
25281
|
const nonceRoute = `${vciRoute}/nonce`;
|
|
25079
25282
|
const vciSigningKey = vciConfig.signingKey ?? signingKey;
|
|
25080
|
-
return new
|
|
25283
|
+
return new Elysia41().get("/.well-known/openid-credential-issuer", () => Response.json(buildIssuerMetadata({
|
|
25081
25284
|
config: vciConfig,
|
|
25082
25285
|
issuer: issuerUrl,
|
|
25083
25286
|
vciRoute
|
|
@@ -25226,7 +25429,7 @@ var verifyStatusListJwt = async ({
|
|
|
25226
25429
|
};
|
|
25227
25430
|
};
|
|
25228
25431
|
// src/vc/statusListRoutes.ts
|
|
25229
|
-
import { Elysia as
|
|
25432
|
+
import { Elysia as Elysia42, t as t34 } from "elysia";
|
|
25230
25433
|
var HTTP_OK5 = 200;
|
|
25231
25434
|
var HTTP_NOT_FOUND = 404;
|
|
25232
25435
|
var DEFAULT_STATUS_ROUTE = "/vc/status";
|
|
@@ -25238,7 +25441,7 @@ var statusListRoutes = ({
|
|
|
25238
25441
|
ttlSeconds
|
|
25239
25442
|
}) => {
|
|
25240
25443
|
const listRoute = `${statusRoute}/:listId`;
|
|
25241
|
-
return new
|
|
25444
|
+
return new Elysia42().get(listRoute, async ({ params: { listId } }) => {
|
|
25242
25445
|
const bits = await getStatusList(listId);
|
|
25243
25446
|
if (bits === undefined) {
|
|
25244
25447
|
return new Response("Not found", { status: HTTP_NOT_FOUND });
|
|
@@ -25459,7 +25662,7 @@ var createInMemoryPresentationRequestStore = () => {
|
|
|
25459
25662
|
};
|
|
25460
25663
|
};
|
|
25461
25664
|
// src/vc/vpRoutes.ts
|
|
25462
|
-
import { Elysia as
|
|
25665
|
+
import { Elysia as Elysia43, t as t35 } from "elysia";
|
|
25463
25666
|
var HTTP_OK6 = 200;
|
|
25464
25667
|
var HTTP_BAD_REQUEST5 = 400;
|
|
25465
25668
|
var HTTP_NOT_FOUND2 = 404;
|
|
@@ -25478,7 +25681,7 @@ var vpRoutes = ({
|
|
|
25478
25681
|
const authorizeRoute = `${vpRoute}/authorize`;
|
|
25479
25682
|
const requestRoute = `${vpRoute}/request/:id`;
|
|
25480
25683
|
const responseRoute = `${vpRoute}/response`;
|
|
25481
|
-
return new
|
|
25684
|
+
return new Elysia43().post(authorizeRoute, async ({ body }) => {
|
|
25482
25685
|
const input = {
|
|
25483
25686
|
clientId: body.client_id ?? defaultClientId,
|
|
25484
25687
|
requestedClaims: body.requested_claims,
|
|
@@ -28653,7 +28856,7 @@ var blockMigrations = {
|
|
|
28653
28856
|
webhooks: initMigration("webhooks", [webhookDeliveriesTable])
|
|
28654
28857
|
};
|
|
28655
28858
|
// src/sso/samlIdpRoutes.ts
|
|
28656
|
-
import { Elysia as
|
|
28859
|
+
import { Elysia as Elysia44, t as t36 } from "elysia";
|
|
28657
28860
|
var HTTP_BAD_REQUEST6 = 400;
|
|
28658
28861
|
var HTTP_UNAUTHORIZED6 = 401;
|
|
28659
28862
|
var HTTP_FOUND2 = 302;
|
|
@@ -28763,7 +28966,7 @@ var samlIdpRoutes = ({
|
|
|
28763
28966
|
user: userSession.user
|
|
28764
28967
|
});
|
|
28765
28968
|
};
|
|
28766
|
-
return new
|
|
28969
|
+
return new Elysia44().use(sessionStore()).post(ssoIdpRoute, async ({ body, cookie: { user_session_id }, request, store }) => handleSpInitiated({
|
|
28767
28970
|
binding: "POST",
|
|
28768
28971
|
body,
|
|
28769
28972
|
inMemorySession: store.session,
|
|
@@ -29060,59 +29263,67 @@ var createInMemorySetupSessionStore = () => {
|
|
|
29060
29263
|
};
|
|
29061
29264
|
|
|
29062
29265
|
// src/index.ts
|
|
29063
|
-
var
|
|
29064
|
-
|
|
29065
|
-
|
|
29066
|
-
|
|
29067
|
-
|
|
29068
|
-
|
|
29069
|
-
|
|
29070
|
-
|
|
29071
|
-
|
|
29072
|
-
|
|
29073
|
-
|
|
29074
|
-
|
|
29075
|
-
|
|
29076
|
-
|
|
29077
|
-
|
|
29078
|
-
|
|
29079
|
-
|
|
29080
|
-
|
|
29081
|
-
|
|
29082
|
-
|
|
29083
|
-
|
|
29084
|
-
|
|
29085
|
-
|
|
29086
|
-
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
|
|
29098
|
-
|
|
29099
|
-
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
|
|
29104
|
-
|
|
29105
|
-
|
|
29106
|
-
|
|
29107
|
-
|
|
29108
|
-
|
|
29109
|
-
|
|
29110
|
-
|
|
29111
|
-
|
|
29112
|
-
|
|
29113
|
-
|
|
29114
|
-
|
|
29115
|
-
|
|
29266
|
+
var validatePositiveOptions = (prefix, options) => {
|
|
29267
|
+
for (const [name2, value] of Object.entries(options)) {
|
|
29268
|
+
if (value !== undefined && (!Number.isFinite(value) || value <= 0)) {
|
|
29269
|
+
throw new Error(`${prefix}.${name2} must be positive`);
|
|
29270
|
+
}
|
|
29271
|
+
}
|
|
29272
|
+
};
|
|
29273
|
+
var buildAuthApplications = async (configuration) => {
|
|
29274
|
+
const {
|
|
29275
|
+
providersConfiguration,
|
|
29276
|
+
authorizeRoute,
|
|
29277
|
+
cookieSecure,
|
|
29278
|
+
callbackRoute,
|
|
29279
|
+
profileRoute,
|
|
29280
|
+
signoutRoute,
|
|
29281
|
+
statusRoute,
|
|
29282
|
+
refreshRoute,
|
|
29283
|
+
revokeRoute,
|
|
29284
|
+
cleanupIntervalMs,
|
|
29285
|
+
maxSessions,
|
|
29286
|
+
sessionDurationMs,
|
|
29287
|
+
authSessionStore,
|
|
29288
|
+
audit,
|
|
29289
|
+
credentials,
|
|
29290
|
+
customProviders,
|
|
29291
|
+
mfa,
|
|
29292
|
+
passwordless,
|
|
29293
|
+
lockout,
|
|
29294
|
+
sessions,
|
|
29295
|
+
sso,
|
|
29296
|
+
scim,
|
|
29297
|
+
apikeys,
|
|
29298
|
+
agentAuth,
|
|
29299
|
+
oidc,
|
|
29300
|
+
organizations,
|
|
29301
|
+
roles,
|
|
29302
|
+
portal,
|
|
29303
|
+
authorization,
|
|
29304
|
+
compliance,
|
|
29305
|
+
webauthn,
|
|
29306
|
+
webhooks,
|
|
29307
|
+
htmx,
|
|
29308
|
+
tracing,
|
|
29309
|
+
resolveAuthIntent,
|
|
29310
|
+
onAuthorizeSuccess,
|
|
29311
|
+
onAuthorizeError,
|
|
29312
|
+
onProfileSuccess,
|
|
29313
|
+
onProfileError,
|
|
29314
|
+
onCallbackSuccess,
|
|
29315
|
+
onLinkIdentity,
|
|
29316
|
+
onLinkIdentityConflict,
|
|
29317
|
+
onLinkConnector,
|
|
29318
|
+
onCallbackError,
|
|
29319
|
+
onStatus,
|
|
29320
|
+
onRefreshSuccess,
|
|
29321
|
+
onRefreshError,
|
|
29322
|
+
onSignOut,
|
|
29323
|
+
onRevocationSuccess,
|
|
29324
|
+
onRevocationError,
|
|
29325
|
+
onSessionCleanup
|
|
29326
|
+
} = configuration;
|
|
29116
29327
|
if (agentAuth?.agentRegistration !== undefined) {
|
|
29117
29328
|
if (oidc === undefined) {
|
|
29118
29329
|
throw new Error("agentAuth.agentRegistration requires the OIDC provider");
|
|
@@ -29131,7 +29342,7 @@ var auth = async ({
|
|
|
29131
29342
|
if (registration2.allowAnonymous === true && registration2.revokeAccessTokens === undefined) {
|
|
29132
29343
|
throw new Error("Anonymous agent registration requires revokeAccessTokens");
|
|
29133
29344
|
}
|
|
29134
|
-
|
|
29345
|
+
validatePositiveOptions("agentAuth.agentRegistration", {
|
|
29135
29346
|
assertionTtlMs: registration2.assertionTtlMs,
|
|
29136
29347
|
attemptTtlMs: registration2.attemptTtlMs,
|
|
29137
29348
|
claimTtlMs: registration2.claimTtlMs,
|
|
@@ -29139,11 +29350,7 @@ var auth = async ({
|
|
|
29139
29350
|
maxCodeAttempts: registration2.maxCodeAttempts,
|
|
29140
29351
|
pollIntervalSeconds: registration2.pollIntervalSeconds,
|
|
29141
29352
|
tokenTtlMs: registration2.tokenTtlMs
|
|
29142
|
-
})
|
|
29143
|
-
if (value !== undefined && (!Number.isFinite(value) || value <= 0)) {
|
|
29144
|
-
throw new Error(`agentAuth.agentRegistration.${name2} must be positive`);
|
|
29145
|
-
}
|
|
29146
|
-
}
|
|
29353
|
+
});
|
|
29147
29354
|
}
|
|
29148
29355
|
if (tracing !== undefined)
|
|
29149
29356
|
await initTracing(tracing);
|
|
@@ -29246,107 +29453,152 @@ var auth = async ({
|
|
|
29246
29453
|
const auditedOnCallbackSuccess = auditEmit ? composeCallbackAudit(onCallbackSuccess, auditEmit) : onCallbackSuccess;
|
|
29247
29454
|
const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
|
|
29248
29455
|
const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
|
|
29249
|
-
const
|
|
29250
|
-
|
|
29251
|
-
|
|
29252
|
-
|
|
29253
|
-
|
|
29254
|
-
|
|
29255
|
-
|
|
29256
|
-
|
|
29257
|
-
|
|
29258
|
-
|
|
29259
|
-
|
|
29260
|
-
|
|
29261
|
-
|
|
29262
|
-
|
|
29263
|
-
|
|
29264
|
-
|
|
29265
|
-
|
|
29266
|
-
|
|
29267
|
-
|
|
29268
|
-
|
|
29269
|
-
|
|
29270
|
-
|
|
29271
|
-
|
|
29272
|
-
|
|
29273
|
-
|
|
29274
|
-
|
|
29275
|
-
|
|
29276
|
-
|
|
29277
|
-
|
|
29278
|
-
|
|
29279
|
-
|
|
29280
|
-
|
|
29281
|
-
|
|
29282
|
-
|
|
29283
|
-
|
|
29284
|
-
|
|
29285
|
-
|
|
29286
|
-
|
|
29287
|
-
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29293
|
-
|
|
29294
|
-
|
|
29295
|
-
|
|
29296
|
-
|
|
29297
|
-
|
|
29298
|
-
|
|
29299
|
-
|
|
29300
|
-
|
|
29301
|
-
|
|
29302
|
-
|
|
29303
|
-
|
|
29304
|
-
|
|
29305
|
-
|
|
29306
|
-
|
|
29307
|
-
|
|
29308
|
-
|
|
29309
|
-
|
|
29310
|
-
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
|
|
29317
|
-
|
|
29318
|
-
|
|
29319
|
-
|
|
29320
|
-
|
|
29321
|
-
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
...
|
|
29328
|
-
|
|
29329
|
-
|
|
29330
|
-
|
|
29331
|
-
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29456
|
+
const pluginSeed = pluginDependencySeed(configuration);
|
|
29457
|
+
const coreRoutes = new Elysia45({
|
|
29458
|
+
name: "@absolutejs/auth/core-routes",
|
|
29459
|
+
seed: pluginSeed
|
|
29460
|
+
}).use([
|
|
29461
|
+
sessionCleanup({
|
|
29462
|
+
authSessionStore,
|
|
29463
|
+
cleanupIntervalMs,
|
|
29464
|
+
maxSessions,
|
|
29465
|
+
onSessionCleanup
|
|
29466
|
+
}),
|
|
29467
|
+
signout({
|
|
29468
|
+
authSessionStore,
|
|
29469
|
+
onSignOut: auditedOnSignOut,
|
|
29470
|
+
signoutRoute
|
|
29471
|
+
}),
|
|
29472
|
+
revoke({
|
|
29473
|
+
authSessionStore,
|
|
29474
|
+
clientProviders,
|
|
29475
|
+
onRevocationError,
|
|
29476
|
+
onRevocationSuccess: auditedOnRevocationSuccess,
|
|
29477
|
+
revokeRoute
|
|
29478
|
+
}),
|
|
29479
|
+
userStatus({ authSessionStore, onStatus, statusRoute }),
|
|
29480
|
+
refresh({
|
|
29481
|
+
authSessionStore,
|
|
29482
|
+
clientProviders,
|
|
29483
|
+
onRefreshError,
|
|
29484
|
+
onRefreshSuccess,
|
|
29485
|
+
refreshRoute,
|
|
29486
|
+
sessionDurationMs
|
|
29487
|
+
}),
|
|
29488
|
+
authorize({
|
|
29489
|
+
authorizeRoute,
|
|
29490
|
+
clientProviders,
|
|
29491
|
+
cookieSecure: resolvedCookieSecure,
|
|
29492
|
+
onAuthorizeError,
|
|
29493
|
+
onAuthorizeSuccess
|
|
29494
|
+
}),
|
|
29495
|
+
callback({
|
|
29496
|
+
authSessionStore,
|
|
29497
|
+
callbackRoute,
|
|
29498
|
+
clientProviders,
|
|
29499
|
+
onCallbackError,
|
|
29500
|
+
onCallbackSuccess: auditedOnCallbackSuccess,
|
|
29501
|
+
onLinkConnector,
|
|
29502
|
+
onLinkIdentity,
|
|
29503
|
+
onLinkIdentityConflict,
|
|
29504
|
+
resolveAuthIntent
|
|
29505
|
+
}),
|
|
29506
|
+
profile({
|
|
29507
|
+
clientProviders,
|
|
29508
|
+
onProfileError,
|
|
29509
|
+
onProfileSuccess,
|
|
29510
|
+
profileRoute
|
|
29511
|
+
})
|
|
29512
|
+
]);
|
|
29513
|
+
const featureRoutes = new Elysia45({
|
|
29514
|
+
name: "@absolutejs/auth/feature-routes",
|
|
29515
|
+
seed: pluginSeed
|
|
29516
|
+
}).use([
|
|
29517
|
+
auditedCredentials ? credentialRoutes({
|
|
29518
|
+
...auditedCredentials,
|
|
29519
|
+
authSessionStore,
|
|
29520
|
+
cookieSecure: resolvedCookieSecure,
|
|
29521
|
+
lockoutGuard
|
|
29522
|
+
}) : new Elysia45,
|
|
29523
|
+
auditedMfa ? mfaRoutes({
|
|
29524
|
+
...auditedMfa,
|
|
29525
|
+
authSessionStore,
|
|
29526
|
+
cookieSecure: resolvedCookieSecure
|
|
29527
|
+
}) : new Elysia45,
|
|
29528
|
+
passwordless ? passwordlessRoutes({
|
|
29529
|
+
...passwordless,
|
|
29530
|
+
authSessionStore,
|
|
29531
|
+
cookieSecure: resolvedCookieSecure,
|
|
29532
|
+
emit: auditEmit
|
|
29533
|
+
}) : new Elysia45,
|
|
29534
|
+
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia45,
|
|
29535
|
+
sso ? oidcSsoRoutes({
|
|
29536
|
+
...sso,
|
|
29537
|
+
authSessionStore,
|
|
29538
|
+
cookieSecure: resolvedCookieSecure
|
|
29539
|
+
}) : new Elysia45,
|
|
29540
|
+
sso && sso.samlAdapter ? samlSsoRoutes({
|
|
29541
|
+
...sso,
|
|
29542
|
+
authSessionStore,
|
|
29543
|
+
cookieSecure: resolvedCookieSecure,
|
|
29544
|
+
samlAdapter: sso.samlAdapter
|
|
29545
|
+
}) : new Elysia45,
|
|
29546
|
+
sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
|
|
29547
|
+
getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
|
|
29548
|
+
ssoConnectionStore: sso.ssoConnectionStore,
|
|
29549
|
+
ssoRoute: sso.ssoRoute
|
|
29550
|
+
}) : new Elysia45,
|
|
29551
|
+
scim ? scimRoutes(scim) : new Elysia45,
|
|
29552
|
+
apikeys ? apiKeysRoutes(apikeys) : new Elysia45,
|
|
29553
|
+
oidcConfig ? oidcProviderRoutes({
|
|
29554
|
+
...oidcConfig,
|
|
29555
|
+
authSessionStore
|
|
29556
|
+
}) : new Elysia45,
|
|
29557
|
+
organizations ? organizationRoutes({
|
|
29558
|
+
...organizations,
|
|
29559
|
+
authSessionStore,
|
|
29560
|
+
emit: auditEmit
|
|
29561
|
+
}) : new Elysia45,
|
|
29562
|
+
roles ? roleRoutes({
|
|
29563
|
+
...roles,
|
|
29564
|
+
authSessionStore,
|
|
29565
|
+
emit: auditEmit
|
|
29566
|
+
}) : new Elysia45,
|
|
29567
|
+
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia45,
|
|
29568
|
+
webauthn ? webauthnRoutes({
|
|
29569
|
+
...webauthn,
|
|
29570
|
+
authSessionStore,
|
|
29571
|
+
cookieSecure: resolvedCookieSecure,
|
|
29572
|
+
emit: auditEmit
|
|
29573
|
+
}) : new Elysia45,
|
|
29574
|
+
compliance ? complianceRoutes({
|
|
29575
|
+
...compliance,
|
|
29576
|
+
authSessionStore,
|
|
29577
|
+
emit: auditEmit
|
|
29578
|
+
}) : new Elysia45,
|
|
29579
|
+
createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
|
|
29580
|
+
agentAuthRoutes(resolvedAgentAuth)
|
|
29581
|
+
]);
|
|
29582
|
+
const authContext = createAuthContext({
|
|
29583
|
+
agentAuth: resolvedAgentAuth,
|
|
29584
|
+
authorization,
|
|
29341
29585
|
authSessionStore,
|
|
29342
|
-
emit: auditEmit
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
|
|
29586
|
+
emit: auditEmit,
|
|
29587
|
+
seedSource: configuration
|
|
29588
|
+
});
|
|
29589
|
+
return { authContext, coreRoutes, featureRoutes };
|
|
29590
|
+
};
|
|
29591
|
+
var auth = async (configuration) => {
|
|
29592
|
+
const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
|
|
29593
|
+
const application = new Elysia45({
|
|
29594
|
+
name: "@absolutejs/auth",
|
|
29595
|
+
seed: pluginDependencySeed(configuration)
|
|
29596
|
+
});
|
|
29597
|
+
application.use(coreRoutes);
|
|
29598
|
+
application.use(featureRoutes);
|
|
29599
|
+
return application.use(authContext);
|
|
29349
29600
|
};
|
|
29601
|
+
var createAuthApplications = async (configuration) => buildAuthApplications(configuration);
|
|
29350
29602
|
|
|
29351
29603
|
// src/server.ts
|
|
29352
29604
|
var auth2 = auth;
|
|
@@ -29358,8 +29610,9 @@ export {
|
|
|
29358
29610
|
isUserSessionId,
|
|
29359
29611
|
instantiateUserSession,
|
|
29360
29612
|
extractPropFromIdentity,
|
|
29613
|
+
createAuthContext,
|
|
29361
29614
|
auth2 as auth
|
|
29362
29615
|
};
|
|
29363
29616
|
|
|
29364
|
-
//# debugId=
|
|
29617
|
+
//# debugId=73EC5483BC26C84964756E2164756E21
|
|
29365
29618
|
//# sourceMappingURL=server.js.map
|