Skip to content

Commit

Permalink
Merge pull request #502 from ferjul17/feat/getRequest-in-IAuthGuard
Browse files Browse the repository at this point in the history
feat: Add getRequest method int IAuthGuard interface
  • Loading branch information
kamilmysliwiec authored Jun 13, 2023
2 parents 43db968 + c0d13d8 commit 767234a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ export type IAuthGuard = CanActivate & {
getAuthenticateOptions(
context: ExecutionContext
): 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.`;
const authLogger = new Logger('AuthGuard');

function createAuthGuard(type?: string | string[]): Type<CanActivate> {
function createAuthGuard(type?: string | string[]): Type<IAuthGuard> {
class MixinAuthGuard<TUser = any> implements CanActivate {
@Optional()
@Inject(AuthModuleOptions)
Expand Down

0 comments on commit 767234a

Please sign in to comment.