本文整理汇总了Scala中com.mohiva.play.silhouette.api.services.AuthenticatorService类的典型用法代码示例。如果您正苦于以下问题:Scala AuthenticatorService类的具体用法?Scala AuthenticatorService怎么用?Scala AuthenticatorService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthenticatorService类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: SilhouetteModule
//设置package包名称以及导入依赖的类
package auth.http.module
import auth.core.DefaultEnv
import auth.core.module.SilhouetteContext
import auth.core.service.BasicUserService
import auth.core.service.authorization.PermissionsAuthorizer
import auth.http.service.impl.BasicUserServiceViaHttpImpl
import auth.http.service.impl.authorization.impl.PermissionsViaHttpAuthorizer
import com.google.inject.{AbstractModule, Provides}
import com.mohiva.play.silhouette.api.{Environment, EventBus}
import com.mohiva.play.silhouette.api.services.AuthenticatorService
import net.codingwell.scalaguice.ScalaModule
import play.api.Configuration
import play.api.libs.ws.WSClient
import scala.concurrent.ExecutionContext
sealed class SilhouetteModule extends AbstractModule with ScalaModule {
override def configure(): Unit = {}
@Provides
def providePermissionsAuthorizer(configuration: Configuration, ws: WSClient)(
implicit ec: ExecutionContext): PermissionsAuthorizer =
new PermissionsViaHttpAuthorizer(configuration, ws)(ec)
@Provides
def provideUserService(configuration: Configuration,
wsClient: WSClient,
@SilhouetteContext ec: ExecutionContext): BasicUserService =
new BasicUserServiceViaHttpImpl(configuration, wsClient)(ec)
@Provides
def provideEnvironment(userService: BasicUserService,
eventBus: EventBus,
authenticatorService: AuthenticatorService[DefaultEnv#A],
@SilhouetteContext ec: ExecutionContext): Environment[DefaultEnv] =
Environment[DefaultEnv](userService, authenticatorService, Seq(), eventBus)(ec)
}