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


Scala EventBus类代码示例

本文整理汇总了Scala中com.mohiva.play.silhouette.api.EventBus的典型用法代码示例。如果您正苦于以下问题:Scala EventBus类的具体用法?Scala EventBus怎么用?Scala EventBus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EventBus类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1:

//设置package包名称以及导入依赖的类
package modules.cake

import com.mohiva.play.silhouette.impl.authenticators.{ CookieAuthenticator, JWTAuthenticator }
import com.mohiva.play.silhouette.impl.util.BCryptPasswordHasher
import com.mohiva.play.silhouette.impl.util.PlayCacheLayer
import com.mohiva.play.silhouette.impl.util.SecureRandomIDGenerator
import com.mohiva.play.silhouette.api.Environment
import com.mohiva.play.silhouette.api.EventBus
import com.mohiva.play.silhouette.api.util.PlayHTTPLayer
import models.users.User
import models.daos._



  lazy val cacheLayer = new PlayCacheLayer
  lazy val httpLayer = new PlayHTTPLayer
  lazy val eventBus = EventBus()
  lazy val idGenerator = new SecureRandomIDGenerator
  lazy val passwordInfoDAO = new PasswordInfoDAO
  lazy val oauth1InfoDAO = new OAuth1InfoDAO
  lazy val oauth2InfoDAO = new OAuth2InfoDAO
  lazy val passwordHasher = new BCryptPasswordHasher

  implicit lazy val env: Environment[User, JWTAuthenticator] = {
    Environment[User, JWTAuthenticator](
      userService,
      authenticatorService,
      Map(
        credentialsProvider.id -> credentialsProvider,
        facebookProvider.id -> facebookProvider),
      eventBus)
  }

} 
开发者ID:Flibberty-GEA,项目名称:silhouette-rest-seed,代码行数:35,代码来源:EnvironmentModule.scala

示例2: 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.EventBus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。