/// <reference types="node" />
import './fetch-polyfill';
import { NextFunction, Request, Response } from 'express';
import { OpenIDConfigurationManager, AuthorizeURLOptions } from '@criipto/oidc';
import { ParamsDictionary } from 'express-serve-static-core';
import passport from 'passport';
import { ParsedQs } from 'qs';
import { createRemoteJWKSet, JWTPayload } from 'jose';
export default class OAuth2Error extends Error {
    error: string;
    error_description?: string;
    state?: string;
    constructor(error: string, error_description?: string, state?: string);
}
export interface CriiptoVerifyJwtOptions {
    domain: string;
    clientID: string;
}
export interface CriiptoVerifyRedirectOptions {
    domain: string;
    clientID: string;
    clientSecret: string;
    /** If no host is included, the current request host will be used. */
    redirectUri: string;
    /** If no host is included, the current request host will be used. */
    postLogoutRedirectUri?: string;
    /** Modify authorize request if needed */
    beforeAuthorize?: (req: Request, options: AuthorizeURLOptions) => AuthorizeURLOptions;
}
export declare class CriiptoVerifyExpressJwt {
    options: CriiptoVerifyJwtOptions;
    jwks: ReturnType<typeof createRemoteJWKSet>;
    configurationManager: OpenIDConfigurationManager;
    constructor(options: CriiptoVerifyJwtOptions);
    process(req: Request): Promise<JWTPayload>;
    middleware(): (req: Request, res: Response, next: NextFunction) => void;
}
export declare class CriiptoVerifyJwtPassportStrategy implements passport.Strategy {
    options: CriiptoVerifyJwtOptions;
    claimsToUser: (input: JWTPayload) => Express.User | Promise<Express.User>;
    helper: CriiptoVerifyExpressJwt;
    constructor(options: CriiptoVerifyJwtOptions, claimsToUser: (input: JWTPayload) => Express.User | Promise<Express.User>);
    authenticate(this: passport.StrategyCreated<this, this & passport.StrategyCreatedStatic> & this, req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>): void;
}
export declare class CriiptoVerifyExpressRedirect {
    options: CriiptoVerifyRedirectOptions;
    jwks: ReturnType<typeof createRemoteJWKSet>;
    configurationManager: OpenIDConfigurationManager;
    constructor(options: CriiptoVerifyRedirectOptions);
    logout(req: Request, res: Response): Promise<void>;
    handleCode(req: Request, redirectUri: string | undefined): Promise<JWTPayload>;
    authorizeURL(req: Request, returnTo?: string): Promise<{
        authorizeUrl: URL;
        redirectUri: import("url").URL;
    }>;
    middleware(options?: {
        force?: boolean;
        failureRedirect?: string;
        successReturnToOrRedirect?: string;
    }): (req: Request, res: Response, next: (err?: Error) => {}) => void;
}
export declare class CriiptoVerifyRedirectPassportStrategy implements passport.Strategy {
    options: CriiptoVerifyRedirectOptions;
    claimsToUser: (input: JWTPayload) => Express.User | Promise<Express.User>;
    jwks: ReturnType<typeof createRemoteJWKSet>;
    configurationManager: OpenIDConfigurationManager;
    helper: CriiptoVerifyExpressRedirect;
    constructor(options: CriiptoVerifyRedirectOptions, claimsToUser: (input: JWTPayload) => Express.User | Promise<Express.User>);
    logout(req: Request, res: Response): void;
    authenticate(this: passport.StrategyCreated<this, this & passport.StrategyCreatedStatic> & this, req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, options?: {
        force?: boolean;
        failureRedirect?: string;
    }): void;
}
