Skip to content

UserProvider classes do not handle hashes with a custom cost factor #6500

@miclf

Description

@miclf

This bug impacts Illuminate’s authentication system.

The DatabaseUserProvider and EloquentUserProvider classes use the \Illuminate\Contracts\Hashing\Hasher interface as a dependency, in order to compare hashed passwords with provided credentials.

The problem is that they use the hasher with all the options set to their default value. As a result, the cost factor (the ‘round’ option) is always equal to 10. If the application uses a different value, hashed passwords stored in the database are never matched and all authentication attempts fail.

I see two possible ways to handle this:

  1. Allow user provider classes to accept hashing options. This could quickly become really messy.
  2. Create an option in a configuration file (similarly to the cipher option in /config/app) and use that. Then it could also be used by the app to hash its user passwords.

Ideas welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions