16 lines
365 B
TypeScript
16 lines
365 B
TypeScript
import type { Request } from 'express';
|
|
|
|
export type AuthRequestContext = {
|
|
clientType: string;
|
|
userAgent: string | null;
|
|
ip: string | null;
|
|
};
|
|
|
|
export function buildAuthRequestContext(request: Request): AuthRequestContext {
|
|
return {
|
|
clientType: 'browser',
|
|
userAgent: request.header('user-agent')?.trim() || null,
|
|
ip: request.ip || null,
|
|
};
|
|
}
|