n8n
Version:
n8n Workflow Automation Tool
40 lines (39 loc) • 1.69 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import type { ICredentialContext } from 'n8n-workflow';
import { z } from 'zod';
import { CacheService } from '../../../../services/cache/cache.service';
import { ITokenIdentifier } from './identifier-interface';
import { OAuth2MetadataHttpClient } from './oauth2-metadata-http-client';
export declare const OAuth2UserInfoOptionsSchema: z.ZodObject<{
metadataUri: z.ZodString;
subjectClaim: z.ZodDefault<z.ZodOptional<z.ZodString>>;
validation: z.ZodLiteral<"oauth2-userinfo">;
}, "strip", z.ZodTypeAny, {
metadataUri: string;
subjectClaim: string;
validation: "oauth2-userinfo";
}, {
metadataUri: string;
subjectClaim?: string | undefined;
validation: "oauth2-userinfo";
}>;
export declare const UserInfoResponseSchema: z.ZodObject<{
sub: z.ZodOptional<z.ZodString>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
sub: z.ZodOptional<z.ZodString>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
sub: z.ZodOptional<z.ZodString>;
}, z.ZodTypeAny, "passthrough">>;
export type UserInfoResponse = z.infer<typeof UserInfoResponseSchema>;
export declare class OAuth2UserInfoIdentifier implements ITokenIdentifier {
private readonly logger;
private readonly cache;
private readonly http;
constructor(logger: Logger, cache: CacheService, http: OAuth2MetadataHttpClient);
validateOptions(identifierOptions: Record<string, unknown>): Promise<void>;
resolve(context: ICredentialContext, identifierOptions: Record<string, unknown>): Promise<string>;
private parseOptions;
private fetchMetadata;
private parseUserInfoResponse;
private resolveBasedOnUserInfo;
}