building out frontend and docker
This commit is contained in:
@@ -4,10 +4,10 @@ import type { Clock } from '#lib/server/sync/core/ports.ts';
|
||||
export const SESSION_COOKIE = 'admin_session';
|
||||
|
||||
export interface AdminAuthConfig {
|
||||
username: string | undefined;
|
||||
password: string | undefined;
|
||||
username?: string;
|
||||
password?: string;
|
||||
/** Signs session tokens. If omitted, a random one is used and sessions end on restart. */
|
||||
sessionSecret: string | undefined;
|
||||
sessionSecret?: string;
|
||||
sessionTtlMs: number;
|
||||
clock: Clock;
|
||||
}
|
||||
@@ -24,6 +24,10 @@ export class AdminAuth {
|
||||
return Boolean(this.config.username && this.config.password);
|
||||
}
|
||||
|
||||
get sessionTtlSeconds(): number {
|
||||
return Math.floor(this.config.sessionTtlMs / 1000);
|
||||
}
|
||||
|
||||
checkCredentials(username: string, password: string): boolean {
|
||||
if (!this.enabled) return false;
|
||||
// Evaluate both so timing doesn't reveal which one was wrong.
|
||||
|
||||
Reference in New Issue
Block a user