import type { Actor } from '../types.js';
import { type McpAuthFactory } from './auth.js';
/** What `oidcAuth()` hands `toActor` for a verified access token. */
export interface OidcActorInfo {
    /** The token's subject (`sub`): the account, or the client of a `client_credentials` token. */
    subject: string;
    /** The verified claims. */
    claims: Record<string, unknown>;
    /** The token's granted scopes (`scope` / `scp`). */
    scopes: string[];
    /** Roles from `rolesClaim`, when the token carries them. */
    roles: string[] | undefined;
    /** The client the token was issued to (`client_id` / `azp`), when named. */
    clientId: string | undefined;
    /**
     * Who is really acting, for an impersonation token (RFC 8693 `act`). Use it for audit; authorize
     * on `subject`.
     */
    actor: {
        sub: string;
        email?: string;
    } | undefined;
    /** Minted for a personal agent (Poppy, `gty: 'poppy'`): the personal-agent gate applies. */
    personalAgent: boolean;
}
/** Map a verified token to the MCP actor. Throw {@link McpAuthError} to refuse it. */
export type OidcActorResolver = (info: OidcActorInfo) => Actor | Promise<Actor>;
export interface OidcMcpAuthOptions {
    /** The authorization server's issuer: the exact `iss` of its tokens, advertised in the metadata. */
    issuer: string;
    /**
     * Accepted `aud` values: the resource URL(s) the tokens are issued for. Default: the endpoint's own
     * URL (`config.publicUrl` + path, else the request's origin + path), as RFC 8707 binds it.
     */
    resource?: string | string[];
    /** The JWKS URL. Default: `jwks_uri` from the issuer's discovery document. */
    jwksUri?: string;
    /** Accepted signing algorithms. Default: the asymmetric ones `jose` supports. */
    algorithms?: string[];
    /** Clock skew allowed on `exp`/`nbf`, in seconds. Default `30`. */
    clockTolerance?: number;
    /** Advertised as `scopes_supported`. Default `['openid', 'profile', 'email', 'offline_access', 'roles']`. */
    scopes?: string[];
    /** Scopes every token must carry, else `403 insufficient_scope`. */
    requiredScopes?: string[];
    /** The claim holding the caller's roles (authkit: its `globalRolesClaim`). Default `'roles'`. */
    rolesClaim?: string;
    /** Map the token to the acting {@link Actor}. Default `{ id: sub, roles }`. */
    toActor?: OidcActorResolver;
    /** Human label for the protected resource. Default `'Agent MCP Server'`. */
    resourceName?: string;
    /**
     * Put a verified user token on the request as an authkit identity (`ctx.authkit`, and `ctx.auth`
     * with `authkitClientGuard`). Default: when `@adonis-agora/authkit-client` is installed. Set `false`
     * for an issuer that is not authkit.
     */
    authkit?: boolean;
}
/**
 * Authenticate MCP clients with JWT access tokens of a remote OAuth / OIDC authorization server
 * (authkit-server on another host, or any issuer with a JWKS). Nothing of the authorization server
 * runs in this process: the token's signature is checked against the issuer's JWKS (found by
 * discovery, keys cached), then `iss`, `aud` (the endpoint's URL by default) and `exp`.
 *
 * The endpoint advertises the issuer in its RFC 9728 metadata and answers a refused request with
 * `WWW-Authenticate: Bearer resource_metadata=…`, so an MCP client opens the login. With authkit, list
 * the endpoint's URL in authkit-server's `mcpClients.resources` so it issues tokens for it.
 *
 * A token that is not a JWT of this issuer is "not mine" (a plain `Error`): inside {@link anyOf} the
 * next strategy gets it. A token it recognizes and refuses throws {@link McpAuthError}.
 */
export declare function oidcAuth(options: OidcMcpAuthOptions): McpAuthFactory;
//# sourceMappingURL=oidc-auth.d.ts.map