refact: cleanup

This commit is contained in:
Morten Olsen
2025-10-16 16:43:44 +02:00
parent 7c30e43ef7
commit 9ba5788d20
19 changed files with 61 additions and 65 deletions

View File

@@ -0,0 +1,23 @@
import type { AuthProvider } from '#root/auth/auth.provider.ts';
class SessionProvider {
#handlers: Map<string, AuthProvider>;
constructor() {
this.#handlers = new Map();
}
public register = (name: string, provider: AuthProvider) => {
this.#handlers.set(name, provider);
};
public validate = (provider: string, token: string) => {
const handler = this.#handlers.get(provider);
if (!handler) {
throw new Error('Provider not available');
}
return handler.getAccess(token);
};
}
export { SessionProvider };