mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
added auth strategies migration, fixed rebuild of modules on migrations
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
type Strategy,
|
||||
} from "auth";
|
||||
import type { PasswordStrategy } from "auth/authenticate/strategies";
|
||||
import { type DB, Exception, type PrimaryFieldType } from "core";
|
||||
import { $console, type DB, Exception, type PrimaryFieldType } from "core";
|
||||
import { type Static, secureRandomString, transformObject } from "core/utils";
|
||||
import type { Entity, EntityManager } from "data";
|
||||
import { type FieldSchema, em, entity, enumm, text } from "data/prototype";
|
||||
@@ -41,6 +41,12 @@ export class AppAuth extends Module<typeof authConfigSchema> {
|
||||
}
|
||||
}
|
||||
|
||||
// @todo: password strategy is required atm
|
||||
if (!to.strategies?.password?.enabled) {
|
||||
$console.warn("Password strategy cannot be disabled.");
|
||||
to.strategies!.password!.enabled = true;
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
@@ -89,6 +95,9 @@ export class AppAuth extends Module<typeof authConfigSchema> {
|
||||
|
||||
isStrategyEnabled(strategy: Strategy | string) {
|
||||
const name = typeof strategy === "string" ? strategy : strategy.getName();
|
||||
// for now, password is always active
|
||||
if (name === "password") return true;
|
||||
|
||||
return this.config.strategies?.[name]?.enabled ?? false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user