Skip to content

Commit

Permalink
feat: add getRequest method int IAuthGuard interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjul17 committed Feb 16, 2021
1 parent 1b180ef commit 871bf00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ export type IAuthGuard = CanActivate & {
): Promise<void>;
handleRequest<TUser = any>(err, user, info, context, status?): TUser;
getAuthenticateOptions(context): IAuthModuleOptions | undefined;
getRequest<T = any>(context: ExecutionContext): T;
};
export const AuthGuard: (
type?: string | string[]
) => Type<IAuthGuard> = memoize(createAuthGuard);

const NO_STRATEGY_ERROR = `In order to use "defaultStrategy", please, ensure to import PassportModule in each place where AuthGuard() is being used. Otherwise, passport won't work correctly.`;

function createAuthGuard(type?: string | string[]): Type<CanActivate> {
function createAuthGuard(type?: string | string[]): Type<IAuthGuard> {
class MixinAuthGuard<TUser = any> implements CanActivate {
constructor(@Optional() protected readonly options?: AuthModuleOptions) {
this.options = this.options || {};
Expand Down

0 comments on commit 871bf00

Please sign in to comment.