I am using play silhouette 4.0.0-BETA4
. Everything seems to work fine except for storing the password. Each time I try to sign a new user up, all it's details are entered except for the password which seems to be stored in passwordinfo
table.
I am using a MySQL database.
I spent a few hours trying to find out where the problem is and I couldn't figure it out.
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.add
should add the password in database.
I tried to debug the add
function of authInfoRepository
and it seems to get me to an add
function in 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))
}
}
I used IntelliJ to evaluate daos.find(_.classTag.runtimeClass == authInfo.getClass)
and it seems to give me an error which I cannot understand (the error is: Could not evaluate due to a change in a source file
; this error appears only when evaluating with IntelliJ, nothing else appears in the logs). If I try to continue the execution, it goes to the case Some
line. If I continue, the debugger return to daos.find
line. I tried to check for implementations of the add
function from the case Some
line and it seems to find only something related to In Memory Database: InMemoryAuthInfoDAO.scala
.
I am not sure if the problem is coming from here but I really cannot understand why it is not adding the password and everything else works as expected.
The code I used was taken from a few exemples from Silhouette website. I don't have much knowledge about security.
If there is anything else missing, please let me know.
Could not evaluate due to a change in a source file
. No changes were made in sources. – Spondylitisbind[DelegableAuthInfoDAO[PasswordInfo]].toInstance(new InMemoryAuthInfoDAO[PasswordInfo])
) I get the following error when compiling: – SpondylitisSilhouetteModule.scala:192: Cannot generate a config value reader for type Option[Option[Seq[com.mohiva.play.silhouette.api.util.RequestPart.Value]]], because value readers cannot be auto-generated for types with type parameters. Consider defining your own ValueReader[Option[Option[Seq[com.mohiva.play.silhouette.api.util.RequestPart.Value]]]]
. Also the latest previous version of silhouette I used had implementations for InMemoryAuthInfo, this version does not. – Spondylitis