在我的代码中,我返回AuthenticatorResult
由embed
. CookieAuthenticatorService
但我收到编译错误
Error:(270, 27) type mismatch;
found : scala.concurrent.Future[com.mohiva.play.silhouette.api.services.AuthenticatorResult]
required: play.api.mvc.Result
result
我的代码是
val result:Future[AuthenticatorResult] = silhouette.env.authenticatorService.embed(cookie, Ok(Json.toJson(JsonResultSuccess("found user"))))
result
如果我返回Ok
而不是返回,则代码有效result
这有效
val result:Future[AuthenticatorResult] = silhouette.env.authenticatorService.embed(cookie, Ok(Json.toJson(JsonResultSuccess("found user"))))
//result
Ok(Json.toJson(JsonResultError("registration not complete")))
我已将我的 Action 定义为
def signInUser = silhouette.UserAwareAction.async {..}
我究竟做错了什么?
AuthenticatorResult
在这里定义 - http://api.play.silhouette.rocks/5.0.0/com/mohiva/play/silhouette/api/services/AuthenticatorResult.html
CookieAuthenticatorService
在这里定义 - http://api.play.silhouette.rocks/5.0.0/com/mohiva/play/silhouette/impl/authenticators/CookieAuthenticatorService.html