You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
481 B

import { PasswordStrategy } from "./password.strategy";
import { OAuthStrategy } from "./oauth.strategy";
import type { IAuthStrategy } from "../../types/auth";
export { PasswordStrategy, OAuthStrategy };
export const strategyRegistry: Record<string, IAuthStrategy> = {
password: new PasswordStrategy(),
};
export function getStrategy(type: string): IAuthStrategy {
const s = strategyRegistry[type];
if (!s) throw new Error(`Unknown auth strategy: ${type}`);
return s;
}