本文整理汇总了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)
}
}
示例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)
}