Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PassportStrategy interface does not contain validate() #929

Open
2 of 4 tasks
MickL opened this issue Jun 13, 2022 · 2 comments
Open
2 of 4 tasks

PassportStrategy interface does not contain validate() #929

MickL opened this issue Jun 13, 2022 · 2 comments
Labels
bug Something isn't working needs triage

Comments

@MickL
Copy link

MickL commented Jun 13, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When following the documentation and extending PassportStrategy the interface does not contain a validate() function and is therefor kinda useless.

import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-local';

@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
...
}

The interface passport.strategy.d.ts looks like this:

import { Type } from '../interfaces';
export declare function PassportStrategy<T extends Type<any> = any>(Strategy: T, name?: string | undefined): {
    new (...args: any[]): InstanceType<T>;
};

I guess this is a bug because in the source file there is an abstract method.

The behavior is the same in latest 7.x and 8.x

Minimum reproduction code

https://github.com/nestjs/nest/tree/master/sample/19-auth-jwt

Steps to reproduce

No response

Expected behavior

The class PassportStrategy should contain an abstract validate() function

Package version

8.x

Passport version

No response

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

In general it is weird that there is no functions what so ever. For example there are functions available like this.success(), this.pass(), this.error() that are also not part of the interface.

@MickL MickL added bug Something isn't working needs triage labels Jun 13, 2022
@AarNtyon
Copy link

a year has passed

@jmcdo29
Copy link
Member

jmcdo29 commented Aug 15, 2023

a year has passed

And no one has made a PR for it. Would you like to @AarNtyon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants