All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mle.play.ws.SyncAuth.scala Maven / Gradle / Ivy

The newest version!
package com.mle.play.ws

import play.api.mvc.RequestHeader

import scala.concurrent.Future

/**
 * @author Michael
 */
trait SyncAuth extends WebSocketController {
  override def authenticateAsync(req: RequestHeader): Future[AuthSuccess] = toFuture(authenticate(req))

  def authenticate(implicit req: RequestHeader): Option[AuthSuccess]

  def toFuture[T](opt: Option[T]) = opt.fold[Future[T]](Future failed new NoSuchElementException)(Future.successful)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy