import type { JwtPayload as IJwtPayload, JwtHeader as IJwtHeader } from "jsonwebtoken"; import type { IdentityData as IIdentityData } from "../features/security/IdentityContext/Identity.js"; import type { Jwk as IJwk } from "../features/security/utils/verifyJwtUsingJwk.js"; export type IJwt = { header: IJwtHeader; payload: IJwtPayload; }; export type OptionalExternal = Omit & { external?: boolean; }; export type IProviderIdentityData = Omit & { /** * Defaults to `admin` it omitted. */ type?: string; profile?: OptionalExternal>; }; export interface IIdentityProvider { isApplicable(token: string): boolean; getIdentity(token: string): Promise; } /** Generic identity provider for token-based authentication. */ export declare const IdentityProvider: import("@webiny/di").Abstraction; export declare namespace IdentityProvider { type Interface = IIdentityProvider; type IdentityData = IProviderIdentityData; type JwtPayload = IJwtPayload; } export interface IJwtIdentityProvider { isApplicable(token: IJwtPayload): boolean; getIdentity(token: string, jwt: IJwt): Promise; } /** JWT-specific identity provider for token validation. */ export declare const JwtIdentityProvider: import("@webiny/di").Abstraction; export declare namespace JwtIdentityProvider { type Interface = IJwtIdentityProvider; type Jwt = IJwt; type JwtPayload = IJwtPayload; type JwtHeader = IJwtHeader; type IdentityData = IProviderIdentityData; } export interface IOidcIdentityProvider { issuer: string; clientId: string; isApplicable(token: IJwtPayload): boolean; getIdentity(jwt: IJwtPayload): Promise; verifyToken?(token: string): Promise; verifyTokenClaims?(token: IJwtPayload): Promise; } /** OIDC-compliant identity provider with issuer validation. */ export declare const OidcIdentityProvider: import("@webiny/di").Abstraction; export declare namespace OidcIdentityProvider { type Interface = IOidcIdentityProvider; type JwtPayload = IJwtPayload; type IdentityData = IProviderIdentityData; } interface IJwkCache { getKeys(issuer: string): Promise; } /** Cache for JSON Web Keys used in JWT verification. */ export declare const JwkCache: import("@webiny/di").Abstraction; export declare namespace JwkCache { type Interface = IJwkCache; type Jwk = IJwk; } export {};