Skip to content

NullReferenceException in PasswordAuthenticationService when credential is null #916

@HappyRoot

Description

@HappyRoot

Hello,

When a user attempts to log in without configured credentials, the system throws an internal server error:

{
  "title": "Internal Server Error",
  "status": 500,
  "detail": "Object reference not set to an instance of an object.",
  "instance": "/master/pwd/Authenticate"
}

Root Cause:
The issue occurs in PasswordAuthenticationService.Validate where PasswordHelper.VerifyHash() receives a null UserCredential object when no credentials are set for the user.

Suggested Solution:
To make the authentication flow more robust, we could add a null-check for the credential parameter in PasswordAuthenticationService before calling PasswordHelper.VerifyHash(). This would prevent the NullReferenceException and allow us to return a more user-friendly error message (e.g. "Authentication data not found").

Thanks for your work on this project! I really appreciate the effort put into maintaining it. If helpful, I’d be happy to discuss this further or contribute a PR with the proposed changes.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions