@vendure/core
Version:
A modern, headless ecommerce framework
30 lines (29 loc) • 1.54 kB
TypeScript
import { CanActivate, ExecutionContext } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { ConfigService } from '../../config/config.service';
import { CustomerChannelAssignmentService } from '../../service/helpers/customer-channel-assignment/customer-channel-assignment.service';
import { RequestContextService } from '../../service/helpers/request-context/request-context.service';
import { ApiKeyService } from '../../service/services/api-key.service';
import { SessionService } from '../../service/services/session.service';
/**
* @description
* A guard which:
*
* 1. checks for the existence of a valid session token in the request and if found,
* attaches the current User entity to the request.
* 2. enforces any permissions required by the target handler (resolver, field resolver or route),
* and throws a ForbiddenError if those permissions are not present.
*/
export declare class AuthGuard implements CanActivate {
private reflector;
private configService;
private requestContextService;
private sessionService;
private customerChannelAssignmentService;
private apiKeyService;
constructor(reflector: Reflector, configService: ConfigService, requestContextService: RequestContextService, sessionService: SessionService, customerChannelAssignmentService: CustomerChannelAssignmentService, apiKeyService: ApiKeyService);
canActivate(context: ExecutionContext): Promise<boolean>;
private setActiveChannel;
private getSession;
private getSessionFromToken;
}