import { AuthorizationCodeStorage, Client, ClientStorage } from '../models'; import { FallthroughError } from '../utils'; import { AssertAccessTokenScope } from './access-token-scope'; export interface AuthorizationRequest { query: { responseType?: string; clientId?: string; redirectUri?: string; scope?: string; state?: string; }; } declare class InteractionError extends FallthroughError { readonly client: Client; readonly req: AuthorizationRequest; constructor(client: Client, req: AuthorizationRequest); } /** * The resource owner is not authenticated, additional interaction is required. */ export declare class Unauthenticated extends InteractionError { } /** * The authorization server can't establish whether the resource owner grants or denies the client's access request, additional interaction is required. */ export declare class UnresolvedAuthorization extends InteractionError { } /** * The authorization server authenticates the resource owner. * * @throws {Unauthenticated} */ export declare type HandleAuthentication = (client: Client, req: AuthorizationRequest) => Promise; /** * The authorization server establishes whether the resource owner grants or denies the client's access request. * * @throws {UnresolvedAuthorization} */ export declare type HandleIsAuthorized = (client: Client, req: AuthorizationRequest, subject: string) => Promise; export declare type HandleAuthorizationRequest = (req: AuthorizationRequest, handleAuthentication: HandleAuthentication, handleIsAuthorized: HandleIsAuthorized) => Promise; export declare const makeHandleAuthorizationRequest: ({ clientStorage, authorizationCodeStorage, assertAccessTokenScope, }: { clientStorage: ClientStorage; authorizationCodeStorage: AuthorizationCodeStorage; assertAccessTokenScope: AssertAccessTokenScope; }) => { handleAuthorizationRequest: HandleAuthorizationRequest; }; export {};