UNPKG

815 BTypeScriptView Raw
1import { Observable } from 'rxjs';
2import { ExecutionContext } from './execution-context.interface';
3/**
4 * Interface defining the `canActivate()` function that must be implemented
5 * by a guard. Return value indicates whether or not the current request is
6 * allowed to proceed. Return can be either synchronous (`boolean`)
7 * or asynchronous (`Promise` or `Observable`).
8 *
9 * @see [Guards](https://docs.nestjs.com/guards)
10 *
11 * @publicApi
12 */
13export interface CanActivate {
14 /**
15 * @param context Current execution context. Provides access to details about
16 * the current request pipeline.
17 *
18 * @returns Value indicating whether or not the current request is allowed to
19 * proceed.
20 */
21 canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>;
22}