Question

How do I implement SecureSocial (newest snapshot version) plugin with Slick (1.0.1) and MySQL database?

I think that I have configured everything completely.

I have something like this in my User model class:

package models.auth

  import securesocial.core._
  import scala.slick.driver.MySQLDriver._

  case class User(identityId: IdentityId,
                  firstName: String,
                  lastName: String,
                  fullName: String,
                  email: Option[String],
                  avatarUrl: Option[String],
                  authMethod: AuthenticationMethod,
                  oAuth1Info: Option[OAuth1Info] = None,
                  oAuth2Info: Option[OAuth2Info] = None,
                  passwordInfo: Option[PasswordInfo] = None) extends Identity

  object User {
      def apply(i: Identity): User = {
          User(
              i.identityId,
              i.firstName,
              i.lastName,
              i.fullName,
              i.email,
              i.avatarUrl,
              i.authMethod,
              i.oAuth1Info,
              i.oAuth2Info,
              i.passwordInfo
          )
     }
}

object Users extends Table[User]("user") {

    def userId = column[Long]("id", O.PrimaryKey, O.AutoInc)

    def providerId = column[String]("providerId")

    def email = column[Option[String]]("email")

    def firstName = column[String]("firstName")

    def lastName = column[String]("lastName")

    def fullName = column[String]("fullName")

    def avatarUrl = column[Option[String]]("avatarUrl")

    def authMethod = column[AuthenticationMethod]("authMethod")

    // oAuth 1
    def token = column[Option[String]]("token")

    def secret = column[Option[String]]("secret")

    // oAuth 2
    def accessToken = column[Option[String]]("accessToken")

    def tokenType = column[Option[String]]("tokenType")

    def expiresIn = column[Option[Int]]("expiresIn")

    def refreshToken = column[Option[String]]("refreshToken")

    // passwordInfo
    def hasher = column[String]("hasher")

    def password = column[String]("password")

    def salt = column[String]("salt")

}

What do I have to do next? What imports to use and methods to implement? Documentation is very poor.

Était-ce utile?

La solution

You'll have to implement the UserService trait by extending the UserServicePlugin object.

The document is not that poor: UserService Documentation.

SecureSocial relies on an implementation of UserService to handle all the operations related to saving/finding users.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top