Link Search Menu Expand Document

Hash strategy

User’s passwords are hashed by default using standard SHA512. This algorithm can be modified using hashStrategy configuration inside userModule DSL. It consists of 2 functions, one which creates the hash and one which checks if a password and a hash are verified together. This works for KDone’s password authentication.

userModule<User> {

   hashStrategy(
      hash = {
         BCryptUtils.hash(it, 10)
      },
      verify = { password, hash ->
         BCryptUtils.verify(password, hash)
      }
   )
}

Copyright © 2021 Dario Pellegrini