class Athena::PasswordHasher::UserPasswordHasher
inherits Reference
#
Hashes and verifies the passwords of users, using the APH::Interface an APH::FactoryInterface returns for them.
hasher = APH::UserPasswordHasher.new APH::Factory.new({User => APH::Native.new})
user = User.new
user.password = hasher.hash_password user, "password"
hasher.password_valid? user, "password" # => true
Included modules
Athena::PasswordHasher::UserPasswordHasherInterface
Constructors#
Methods#
#hash_password(user : APH::PasswordAuthenticatedUserInterface, plain_password : String) : String#
Returns the hash of the provided plain_password for the provided user.
#needs_rehash?(user : APH::PasswordAuthenticatedUserInterface) : Bool#
Returns true if the password of the provided user would benefit from being re-hashed, otherwise false.
Always returns false if the user has no password.
#password_valid?(user : APH::PasswordAuthenticatedUserInterface, plain_password : String) : Bool#
Returns true if the provided plain_password matches the password of the provided user, otherwise false.
Always returns false if the user has no password.