当前位置: 首页>>代码示例>>Scala>>正文


Scala AuthenticatorService类代码示例

本文整理汇总了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)
} 
开发者ID:KadekM,项目名称:play-slick-silhouette-auth-api,代码行数:39,代码来源:SilhouetteModule.scala


注:本文中的com.mohiva.play.silhouette.api.services.AuthenticatorService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。