feat: centralize application framework primitives
This commit is contained in:
@@ -61,6 +61,8 @@ function handlersFor(ctx: Context): AuthHttpHandlers | undefined {
|
||||
baseUrl: routeOptions.baseUrl ?? ctx.url.origin,
|
||||
passkey: routeOptions.passkey,
|
||||
onSessionVerification: routeOptions.onSessionVerification,
|
||||
oauth: routeOptions.oauth,
|
||||
oauthMfaPath: routeOptions.oauthMfaPath,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Context } from "@wrnexus/core";
|
||||
import { invokeAuthHandler } from "../api.ts";
|
||||
|
||||
export function GET(ctx: Context): Promise<Response> {
|
||||
return invokeAuthHandler("completeOAuth", ctx);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Context } from "@wrnexus/core";
|
||||
import { invokeAuthHandler } from "../api.ts";
|
||||
|
||||
export function GET(ctx: Context): Promise<Response> {
|
||||
return invokeAuthHandler("startOAuth", ctx);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Context } from "@wrnexus/core";
|
||||
import { invokeAuthHandler } from "../api.ts";
|
||||
|
||||
export function GET(ctx: Context): Promise<Response> {
|
||||
return invokeAuthHandler("oauthProviders", ctx);
|
||||
}
|
||||
@@ -12,7 +12,8 @@ export type AuthRouteGroup =
|
||||
| "mfa"
|
||||
| "sessions"
|
||||
| "impersonation"
|
||||
| "passkeys";
|
||||
| "passkeys"
|
||||
| "oauth";
|
||||
|
||||
export interface AuthRouteDefinition {
|
||||
path: string;
|
||||
@@ -23,6 +24,24 @@ export interface AuthRouteDefinition {
|
||||
|
||||
/** Single source of truth for package-contributed auth endpoints. */
|
||||
export const AUTH_ROUTE_DEFINITIONS = [
|
||||
{
|
||||
path: "/api/auth/oauth/providers",
|
||||
group: "oauth",
|
||||
handler: "oauthProviders",
|
||||
methods: ["GET"],
|
||||
},
|
||||
{
|
||||
path: "/api/auth/oauth/[provider]",
|
||||
group: "oauth",
|
||||
handler: "startOAuth",
|
||||
methods: ["GET"],
|
||||
},
|
||||
{
|
||||
path: "/api/auth/oauth/[provider]/callback",
|
||||
group: "oauth",
|
||||
handler: "completeOAuth",
|
||||
methods: ["GET"],
|
||||
},
|
||||
{
|
||||
path: "/api/auth/session/verify",
|
||||
group: "sessions",
|
||||
|
||||
Reference in New Issue
Block a user