如何使用和数据库实现SecureSocial
(最新快照版本)插件?Slick (1.0.1)
MySQL
我认为我已经完全配置了所有内容。
我的用户模型类中有这样的东西:
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")
}
接下来我该怎么办?使用哪些导入和实现方法?文档很差。