mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 16:46:00 +00:00
Merge remote-tracking branch 'origin/release/0.16' into feat/auth-strategies-registry
# Conflicts: # app/src/auth/auth-schema.ts # app/src/core/index.ts # app/src/media/AppMedia.ts # app/src/media/index.ts # app/src/media/media-schema.ts # app/src/modules/registries.ts # app/src/ui/routes/auth/auth.strategies.tsx
This commit is contained in:
+16
-8
@@ -1,18 +1,26 @@
|
||||
import { Authenticator, AuthPermissions, Role, type Strategy } from "auth";
|
||||
import type { PasswordStrategy } from "auth/authenticate/strategies";
|
||||
import type { DB } from "core";
|
||||
import type { DB } from "bknd";
|
||||
import * as AuthPermissions from "auth/auth-permissions";
|
||||
import type { AuthStrategy } from "auth/authenticate/strategies/Strategy";
|
||||
import type { PasswordStrategy } from "auth/authenticate/strategies/PasswordStrategy";
|
||||
import { $console, secureRandomString, transformObject } from "core/utils";
|
||||
import type { Entity, EntityManager } from "data";
|
||||
import type { Entity, EntityManager } from "data/entities";
|
||||
import { em, entity, enumm, type FieldSchema } from "data/prototype";
|
||||
import { Module } from "modules/Module";
|
||||
import { AuthController } from "./api/AuthController";
|
||||
import { type AppAuthSchema, authConfigSchema, AuthStrategyRegistry } from "./auth-schema";
|
||||
import {
|
||||
type AppAuthSchema,
|
||||
authConfigSchema,
|
||||
AuthStrategyRegistry,
|
||||
buildAuthSchema,
|
||||
} from "./auth-schema";
|
||||
import { AppUserPool } from "auth/AppUserPool";
|
||||
import type { AppEntity } from "core/config";
|
||||
import { usersFields } from "./auth-entities";
|
||||
import { Authenticator } from "./authenticate/Authenticator";
|
||||
import { Role } from "./authorize/Role";
|
||||
|
||||
export type UserFieldSchema = FieldSchema<typeof AppAuth.usersFields>;
|
||||
declare module "core" {
|
||||
declare module "bknd" {
|
||||
interface Users extends AppEntity, UserFieldSchema {}
|
||||
interface DB {
|
||||
users: Users;
|
||||
@@ -89,7 +97,7 @@ export class AppAuth extends Module<AppAuthSchema> {
|
||||
this.ctx.guard.registerPermissions(AuthPermissions);
|
||||
}
|
||||
|
||||
isStrategyEnabled(strategy: Strategy | string) {
|
||||
isStrategyEnabled(strategy: AuthStrategy | string) {
|
||||
const name = typeof strategy === "string" ? strategy : strategy.getName();
|
||||
// for now, password is always active
|
||||
if (name === "password") return true;
|
||||
@@ -106,7 +114,7 @@ export class AppAuth extends Module<AppAuthSchema> {
|
||||
}
|
||||
|
||||
getSchema() {
|
||||
return authConfigSchema;
|
||||
return buildAuthSchema();
|
||||
}
|
||||
|
||||
get authenticator(): Authenticator {
|
||||
|
||||
Reference in New Issue
Block a user