Skip to content

SEC-1783: Can't tell the difference between no credentials and invalid credentials #2019

Closed
@spring-projects-issues

Description

@spring-projects-issues

Paul Benedict (Migrated from SEC-1783) said:

I need to record the number of password failures for existing users. DaoAuthenticationProvider#additionalAuthenticationChecks() is where I could do this, except BadCredentialsException is thrown for both (log messages) "no credentials provided" and "password does not match stored value". There's no way to distinguish the two at runtime. There's some refactoring here that could be done. Here are my suggestions:

  1. Subclass BadCredentialsException with new NoCredentialsException and InvalidCredentialsException
  2. Move the call to PasswordEncoder#isPasswordValid() to a new isPasswordValid() method whose default is to call the password encoder.

Of the two choices, I prefer #1

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreAn issue in spring-security-corestatus: declinedA suggestion or change that we don't feel we should currently applytype: jiraAn issue that was migrated from JIRA

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions