/**
 * Authentication Middleware
 * Generic authentication utilities for Express applications
 */
import { Request, Response, NextFunction } from "express";
declare global {
    namespace Express {
        interface Request {
            user?: {
                id: string;
                username: string;
                roles?: string[];
            };
        }
    }
}
declare module "express-session" {
    interface SessionData {
        authenticated?: boolean;
        username?: string;
        userId?: string;
        roles?: string[];
    }
}
export interface AuthConfig {
    loginPath?: string;
    apiPrefix?: string;
    excludePaths?: string[];
    onUnauthorized?: (req: Request, res: Response) => void;
}
/**
 * Creates authentication middleware with configuration
 */
export declare function createAuthMiddleware(config?: AuthConfig): (req: Request, res: Response, next: NextFunction) => void;
/**
 * Login handler factory
 */
export interface LoginCredentials {
    username: string;
    password: string;
}
export interface AuthService {
    validateCredentials: (credentials: LoginCredentials) => Promise<{
        valid: boolean;
        user?: {
            id: string;
            username: string;
            roles?: string[];
        };
        error?: string;
    }>;
}
export declare function createLoginHandler(authService: AuthService): (req: Request, res: Response) => Promise<void>;
/**
 * Logout handler factory
 */
export declare function createLogoutHandler(): (req: Request, res: Response) => void;
/**
 * Auth check handler
 */
export declare function createAuthCheckHandler(): (req: Request, res: Response) => void;
/**
 * Role-based access control middleware
 */
export declare function requireRole(roles: string | string[]): (req: Request, res: Response, next: NextFunction) => void;
/**
 * Simple in-memory auth service for development
 */
export declare class SimpleAuthService implements AuthService {
    private users;
    constructor(users?: Array<{
        username: string;
        password: string;
        id?: string;
        roles?: string[];
    }>);
    validateCredentials(credentials: LoginCredentials): Promise<{
        valid: boolean;
        error: string;
        user?: undefined;
    } | {
        valid: boolean;
        user: {
            id: string;
            username: string;
            roles: string[] | undefined;
        };
        error?: undefined;
    }>;
    addUser(username: string, password: string, roles?: string[]): void;
}
declare const _default: {
    createAuthMiddleware: typeof createAuthMiddleware;
    createLoginHandler: typeof createLoginHandler;
    createLogoutHandler: typeof createLogoutHandler;
    createAuthCheckHandler: typeof createAuthCheckHandler;
    requireRole: typeof requireRole;
    SimpleAuthService: typeof SimpleAuthService;
};
export default _default;
//# sourceMappingURL=auth.d.ts.map