mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
Enhance authentication and authorization components
- Refactored `AppAuth` to introduce `getGuardContextSchema` for improved user context handling. - Updated `Authenticator` to utilize `pickKeys` for user data extraction in JWT generation. - Enhanced `Guard` class to improve permission checks and error handling. - Modified `SystemController` to return context schema alongside permissions in API responses. - Added new `permissions` method in `SystemApi` for fetching permissions. - Improved UI components with additional props and tooltip support for better user experience.
This commit is contained in:
@@ -69,10 +69,13 @@ export class SystemController extends Controller {
|
||||
if (!config.mcp.enabled) {
|
||||
return;
|
||||
}
|
||||
const { permission } = this.middlewares;
|
||||
|
||||
this.registerMcp();
|
||||
|
||||
app.server.use(
|
||||
app.server.all(
|
||||
config.mcp.path,
|
||||
permission(SystemPermissions.mcp, {}),
|
||||
mcpMiddleware({
|
||||
setup: async () => {
|
||||
if (!this._mcpServer) {
|
||||
@@ -110,7 +113,6 @@ export class SystemController extends Controller {
|
||||
explainEndpoint: true,
|
||||
},
|
||||
endpoint: {
|
||||
path: config.mcp.path as any,
|
||||
// @ts-ignore
|
||||
_init: isNode() ? { duplex: "half" } : {},
|
||||
},
|
||||
@@ -415,7 +417,6 @@ export class SystemController extends Controller {
|
||||
schema,
|
||||
config: config ? this.app.toJSON(secrets) : undefined,
|
||||
permissions: this.app.modules.ctx().guard.getPermissions(),
|
||||
//permissions: this.app.modules.ctx().guard.getPermissionNames(),
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -428,7 +429,7 @@ export class SystemController extends Controller {
|
||||
}),
|
||||
(c) => {
|
||||
const permissions = this.app.modules.ctx().guard.getPermissions();
|
||||
return c.json({ permissions });
|
||||
return c.json({ permissions, context: this.app.module.auth.getGuardContextSchema() });
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user