/*!
 * name: nuget-server
 * version: 0.19.0
 * description: NuGet server on Node.js
 * author: Kouji Matsui (@kekyo@mi.kekyo.net)
 * license: MIT
 * repository.url: https://github.com/kekyo/nuget-server.git
 * git.commit.hash: 5b9501882b352a0490b3091210ed1740cfb81389
 */

import { FastifyRequest, FastifyReply } from 'fastify';
import { Strategy as LocalStrategy } from 'passport-local';
import { BasicStrategy } from 'passport-http';
import { Logger } from '../types';
import { UserService } from '../services/userService';
import { SessionService } from '../services/sessionService';
import { AuthFailureTracker } from '../services/authFailureTracker';
/**
 * Fastify authentication middleware configuration
 */
export interface FastifyAuthConfig {
    realm?: string;
    userService: UserService;
    sessionService: SessionService;
    authFailureTracker?: AuthFailureTracker;
    logger: Logger;
}
/**
 * Extended Fastify request interface with user information
 */
export interface AuthenticatedFastifyRequest extends FastifyRequest {
    user?: {
        username: string;
        role: string;
    };
}
/**
 * Creates Passport.js Local Strategy for UI authentication
 * @param config - Authentication configuration
 * @returns Local strategy instance
 */
export declare const createLocalStrategy: (config: FastifyAuthConfig) => LocalStrategy;
/**
 * Creates Passport.js Basic Strategy for API authentication
 * @param config - Authentication configuration
 * @returns Basic strategy instance
 */
export declare const createBasicStrategy: (config: FastifyAuthConfig) => BasicStrategy;
/**
 * Creates hybrid authentication middleware that supports both session and Basic auth
 * @param config - Authentication configuration
 * @returns Fastify hook function
 */
export declare const createHybridAuthMiddleware: (config: FastifyAuthConfig) => (request: AuthenticatedFastifyRequest, reply: FastifyReply) => Promise<void>;
/**
 * Creates a conditional hybrid authentication middleware
 * @param config - Authentication configuration
 * @param skipAuth - If true, skip authentication regardless of configuration
 * @returns Fastify hook function that conditionally applies authentication
 */
export declare const createConditionalHybridAuthMiddleware: (config: FastifyAuthConfig, skipAuth?: boolean) => (request: AuthenticatedFastifyRequest, reply: FastifyReply) => Promise<void>;
/**
 * Creates Session-only authentication middleware (for UI APIs)
 * @param config - Authentication configuration
 * @returns Fastify hook function
 */
export declare const createSessionOnlyAuthMiddleware: (config: FastifyAuthConfig) => (request: AuthenticatedFastifyRequest, reply: FastifyReply) => Promise<undefined>;
/**
 * Creates a role-based authorization middleware
 * @param requiredRoles - Array of required roles (user must have at least one)
 * @param logger - Logger instance
 * @returns Fastify hook function
 */
export declare const createRoleAuthorizationMiddleware: (requiredRoles: string[], logger: Logger) => (request: AuthenticatedFastifyRequest, reply: FastifyReply) => Promise<undefined>;
/**
 * Helper function to check if user has required role
 * @param request - Authenticated Fastify request
 * @param roles - Required roles
 * @returns True if user has required role
 */
export declare const requireRole: (request: AuthenticatedFastifyRequest, roles: string[]) => boolean;
//# sourceMappingURL=fastifyAuth.d.ts.map