MCPcopy Index your code
hub / github.com/coder/mux / getCurrentServerAuthSessionId

Function getCurrentServerAuthSessionId

src/node/orpc/router.ts:638–659  ·  view source on GitHub ↗
(context: ORPCContext)

Source from the content-addressed store, hash-verified

636}
637
638async function getCurrentServerAuthSessionId(context: ORPCContext): Promise<string | null> {
639 const sessionTokens = extractCookieValues(
640 context.headers?.cookie,
641 SERVER_AUTH_SESSION_COOKIE_NAME
642 );
643 if (sessionTokens.length === 0) {
644 return null;
645 }
646
647 for (const sessionToken of sessionTokens) {
648 const validation = await context.serverAuthService.validateSessionToken(sessionToken, {
649 userAgent: getFirstHeaderValue(context.headers, "user-agent"),
650 ipAddress: extractClientIpAddress(context.headers),
651 });
652
653 if (validation?.sessionId) {
654 return validation.sessionId;
655 }
656 }
657
658 return null;
659}
660
661/**
662 * Translate goal-board service errors (`WorkspaceGoalTransitionError`,

Callers 1

routerFunction · 0.85

Calls 4

extractCookieValuesFunction · 0.90
getFirstHeaderValueFunction · 0.90
extractClientIpAddressFunction · 0.90
validateSessionTokenMethod · 0.80

Tested by

no test coverage detected