bhoriuchi / passport-activedirectory

Active Directory strategy for passport.js
29 stars 16 forks source link

InvalidCredentialsError should result in 401, not 500 #5

Closed LoneRifle closed 1 year ago

LoneRifle commented 6 years ago

When integrated: false, the auth callback in line 123 treats all errors the same, ie 500.

This includes InvalidCredentialsError, which really should be treated as an authentication failure, ie 401.

Treating InvalidCredentialsError as auth failure is in-line with the spec written for strategies, as documented in https://github.com/jaredhanson/passport/blob/master/lib/middleware/authenticate.js#L279 and https://github.com/jaredhanson/passport/blob/master/lib/middleware/authenticate.js#L341.

bhoriuchi commented 1 year ago

PR's welcome