feat(core): Add pluggable auth providers, storage hooks, multi-upstream cache awareness, and PyPI/RubyGems protocol implementations
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
import type * as plugins from '../plugins.js';
|
||||
import type { IProtocolUpstreamConfig } from '../upstream/interfaces.upstream.js';
|
||||
import type { IAuthProvider } from './interfaces.auth.js';
|
||||
import type { IStorageHooks } from './interfaces.storage.js';
|
||||
|
||||
/**
|
||||
* Registry protocol types
|
||||
@@ -97,6 +99,20 @@ export interface IProtocolConfig {
|
||||
export interface IRegistryConfig {
|
||||
storage: IStorageConfig;
|
||||
auth: IAuthConfig;
|
||||
|
||||
/**
|
||||
* Custom authentication provider.
|
||||
* If not provided, uses the default in-memory auth provider.
|
||||
* Implement IAuthProvider to integrate LDAP, OAuth, SSO, etc.
|
||||
*/
|
||||
authProvider?: IAuthProvider;
|
||||
|
||||
/**
|
||||
* Storage event hooks for quota tracking, audit logging, etc.
|
||||
* Called before/after storage operations.
|
||||
*/
|
||||
storageHooks?: IStorageHooks;
|
||||
|
||||
oci?: IProtocolConfig;
|
||||
npm?: IProtocolConfig;
|
||||
maven?: IProtocolConfig;
|
||||
@@ -152,6 +168,24 @@ export interface IRegistryError {
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actor information - identifies who is performing the request
|
||||
*/
|
||||
export interface IRequestActor {
|
||||
/** User ID (from validated token) */
|
||||
userId?: string;
|
||||
/** Token ID/hash for audit purposes */
|
||||
tokenId?: string;
|
||||
/** Client IP address */
|
||||
ip?: string;
|
||||
/** Client User-Agent */
|
||||
userAgent?: string;
|
||||
/** Organization ID (for multi-tenant setups) */
|
||||
orgId?: string;
|
||||
/** Session ID */
|
||||
sessionId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base request context
|
||||
*/
|
||||
@@ -168,6 +202,11 @@ export interface IRequestContext {
|
||||
*/
|
||||
rawBody?: Buffer;
|
||||
token?: string;
|
||||
/**
|
||||
* Actor information - identifies who is performing the request.
|
||||
* Populated after authentication for audit logging, quota enforcement, etc.
|
||||
*/
|
||||
actor?: IRequestActor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user