Playing silhouette does not insert a password into the database table

I use play silhouette 4.0.0-BETA4. Everything seems to be working fine except save the password. Every time I try to sign a new user, all his data is entered except for the password, which seems to be stored in a table passwordinfo.

I am using a MySQL database.

I spent several hours trying to figure out what the problem was, and I could not understand.

build.sbt

  "com.mohiva" %% "play-silhouette" % "4.0.0-BETA4",
  "com.mohiva" %% "play-silhouette-persistence-memory" % "4.0.0-BETA4",
  "com.mohiva" %% "play-silhouette-password-bcrypt" % "4.0.0-BETA4",
  "com.mohiva" %% "play-silhouette-testkit" % "4.0.0-BETA4" % "test"

SignUpController

val user = User(
  None,
  userID = UUID.randomUUID(),
  loginInfo = loginInfo,
  firstName = Some(data.firstName),
  lastName = Some(data.lastName),
  fullName = Some(data.firstName + " " + data.lastName),
  email = Some(data.email),
  avatarURL = None
)
for {
  avatar <- avatarService.retrieveURL(data.email)
  user <- userService.save(user.copy(avatarURL = avatar))
  authInfo <- authInfoRepository.add(loginInfo, authInfo)
  authenticator <- silhouette.env.authenticatorService.create(loginInfo)
  token <- silhouette.env.authenticatorService.init(authenticator)
} yield {
  silhouette.env.eventBus.publish(SignUpEvent(user, request))
  silhouette.env.eventBus.publish(LoginEvent(user, request))
  Ok(Json.obj("token" -> token))
}

Here authInfoRepository.addshould add a password to the database.

I tried to debug the function add authInfoRepository, and it looks like it returns the function addin DelegableAuthInfoRepository.scala. Here is the function:

  override def add[T <: AuthInfo](loginInfo: LoginInfo, authInfo: T): Future[T] = {
    daos.find(_.classTag.runtimeClass == authInfo.getClass) match {
      case Some(dao) => dao.asInstanceOf[AuthInfoDAO[T]].add(loginInfo, authInfo)
      case _         => throw new ConfigurationException(AddError.format(authInfo.getClass))
    }
  }

IntelliJ daos.find(_.classTag.runtimeClass == authInfo.getClass) , , , (: Could not evaluate due to a change in a source file; IntelliJ, ). , case Some. , daos.find. add case Some , , - In Memory Database: InMemoryAuthInfoDAO.scala.

, , , , , .

Silhouette. .

- , .

+4
1

. .

/** SilhouetteModule.scala */

import net.ceedubs.ficus.readers.EnumerationReader._

, : D

+7

All Articles