/** * ABAC Attribute Providers * * Attribute providers are responsible for dynamically retrieving attributes * from various sources (databases, external services, etc.) during policy evaluation. * This implements the Policy Information Point (PIP) component of ABAC architecture. */ import { ILogger } from '../logger'; import { AttributeContext, AttributeProvider, AttributeValue, DatabaseConnection, LdapClient } from './types'; /** * Base abstract class for attribute providers */ export declare abstract class BaseAttributeProvider implements AttributeProvider { readonly category: 'subject' | 'resource' | 'environment'; readonly name: string; protected logger: ILogger; constructor(category: 'subject' | 'resource' | 'environment', name: string, logger?: ILogger); abstract getAttributes(id: string, context?: AttributeContext): Promise>; abstract supportsAttribute(attributeId: string): boolean; } /** * In-memory attribute provider for testing and simple use cases */ export declare class InMemoryAttributeProvider extends BaseAttributeProvider { private attributes; private supportedAttributes; constructor(category: 'subject' | 'resource' | 'environment', name: string, initialData?: Record>, logger?: ILogger); getAttributes(id: string): Promise>; supportsAttribute(attributeId: string): boolean; /** * Add attributes for an entity */ addAttributes(id: string, attributes: Record): void; /** * Remove attributes for an entity */ removeAttributes(id: string): void; /** * Clear all attributes */ clear(): void; } /** * Database attribute provider for SQL databases */ export declare class DatabaseAttributeProvider extends BaseAttributeProvider { private connectionString; private tableMapping; private attributeMapping; private db; constructor(category: 'subject' | 'resource' | 'environment', name: string, config: { connectionString: string; tableMapping: Record; attributeMapping: Record; db?: DatabaseConnection; }, logger?: ILogger); getAttributes(id: string, _context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; /** * Set database connection */ setDatabase(db: DatabaseConnection): void; } /** * REST API attribute provider */ export declare class RestApiAttributeProvider extends BaseAttributeProvider { private baseUrl; private endpoints; private headers; private timeout; constructor(category: 'subject' | 'resource' | 'environment', name: string, config: { baseUrl: string; endpoints: Record; headers?: Record; timeout?: number; }, logger?: ILogger); getAttributes(id: string, _context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; } /** * LDAP/Active Directory attribute provider */ export declare class LdapAttributeProvider extends BaseAttributeProvider { private config; private ldapClient; constructor(category: 'subject' | 'resource' | 'environment', name: string, config: { url: string; bindDn: string; bindPassword: string; searchBase: string; attributeMapping: Record; ldapClient?: LdapClient; }, logger?: ILogger); getAttributes(id: string, _context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; /** * Set LDAP client */ setLdapClient(client: LdapClient): void; } /** * Environment attribute provider for contextual information */ export declare class EnvironmentAttributeProvider extends BaseAttributeProvider { private staticAttributes; constructor(name?: string, logger?: ILogger); getAttributes(_id: string, context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; /** * Add static environment attributes */ addStaticAttribute(name: string, value: AttributeValue): void; /** * Remove static attribute */ removeStaticAttribute(name: string): void; /** * Extract IP address from request object */ private extractIpAddress; } /** * Cached attribute provider wrapper */ export declare class CachedAttributeProvider extends BaseAttributeProvider { private provider; private cache; private ttl; constructor(provider: AttributeProvider, ttlSeconds?: number); getAttributes(id: string, context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; /** * Clear cache */ clearCache(): void; /** * Clear cache for specific ID */ clearCacheFor(id: string): void; /** * Clean up expired cache entries */ private cleanupExpiredEntries; } /** * Composite attribute provider that combines multiple providers */ export declare class CompositeAttributeProvider extends BaseAttributeProvider { private providers; constructor(category: 'subject' | 'resource' | 'environment', name: string, providers: AttributeProvider[], logger?: ILogger); getAttributes(id: string, context?: AttributeContext): Promise>; supportsAttribute(attributeId: string): boolean; /** * Add a provider */ addProvider(provider: AttributeProvider): void; /** * Remove a provider */ removeProvider(providerName: string): void; } //# sourceMappingURL=attributeProviders.d.ts.map