n8n
Version:
n8n Workflow Automation Tool
43 lines (42 loc) • 1.88 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import type { User } from '@n8n/db';
import { OAuthClientRepository } from './database/repositories/oauth-client.repository';
import { UserConsentRepository } from './database/repositories/oauth-user-consent.repository';
import { OAuthAuthorizationCodeService } from './oauth-authorization-code.service';
import { OAuthSessionService } from './oauth-session.service';
import { ProtectedResourceRegistry } from '../../services/protected-resource.registry';
import { UrlService } from '../../services/url.service';
type ConsentDetailsResult = {
ok: true;
clientName: string;
clientId: string;
resourceName?: string;
redirectUri?: string;
scopes: string[];
previousScopes?: string[];
scopeTools?: Record<string, string[]>;
} | {
ok: false;
reason: 'resource_unavailable';
} | {
ok: false;
reason: 'forbidden';
};
export declare class OAuthConsentService {
private readonly logger;
private readonly oauthSessionService;
private readonly oauthClientRepository;
private readonly userConsentRepository;
private readonly authorizationCodeService;
private readonly protectedResourceRegistry;
private readonly urlService;
constructor(logger: Logger, oauthSessionService: OAuthSessionService, oauthClientRepository: OAuthClientRepository, userConsentRepository: UserConsentRepository, authorizationCodeService: OAuthAuthorizationCodeService, protectedResourceRegistry: ProtectedResourceRegistry, urlService: UrlService);
getConsentDetails(sessionToken: string, user: User): Promise<ConsentDetailsResult | null>;
private grantableScopes;
private previousScopes;
handleConsentDecision(sessionToken: string, user: User, approved: boolean, scopes?: string[]): Promise<{
redirectUrl: string;
}>;
private resolveGrantedScopes;
}
export {};