I'm looking at the Play Silhouette seed example:
https://github.com/mohiva/play-silhouette-seed
It is clear how to add persistence to UserDAO
and AuthTokenDAO
because they have in memory implementations UserDAOImpl
and AuthTokenDAOImpl
which you can override and provide database implementations like MongoUserDAOImpl
and MongoAuthTokenDAOImpl
.
However I'm puzzled by where hashed passwords are stored. There is no DAO for this in the example.
This is the point where the user submits a registration password:
val authInfo = passwordHasherRegistry.current.hash(data.password)
How can I add persistence to passwordHasherRegistry?
You probably don't need to add persistence to
passwordHasherRegistry
.passwordHasherRegistry
is an object that contains a list of current and historical hash functions used to hash the password so you can verify it.According to the Persistence docs page to persist hashed password information you should provide implementation of
AuthInfoRepository
trait. You may useDelegableAuthInfoRepository
that delegates the work to instance(s) ofDelegableAuthInfoDAO
. See also Silhouette Persistence ReactiveMongo GitHub repository that provides some Mongo-based implementationMongoAuthInfoDAO