MCPcopy
hub / github.com/codeaashu/claude-code / authenticate

Method authenticate

src/server/web/auth/apikey-auth.ts:38–54  ·  view source on GitHub ↗
(req: IncomingMessage)

Source from the content-addressed store, hash-verified

36 }
37
38 authenticate(req: IncomingMessage): AuthUser | null {
39 const session = this.store.getFromRequest(req);
40 if (!session || !session.encryptedApiKey) return null;
41
42 const apiKey = this.store.decrypt(session.encryptedApiKey);
43 if (!apiKey) return null;
44
45 return {
46 id: session.userId,
47 email: session.email,
48 name: session.name,
49 isAdmin:
50 session.isAdmin ||
51 this.adminUsers.has(session.userId),
52 apiKey,
53 };
54 }
55
56 setupRoutes(app: Application): void {
57 const loginHtml = this.loadLoginPage();

Callers 1

requireAuthMethod · 0.95

Calls 3

getFromRequestMethod · 0.80
decryptMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected