Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
the description for this gist
trait AuthorizationHandler extends SprayJsonSupport with DefaultJsonProtocol {
implicit def executionContext: ExecutionContext
implicit def materializer: ActorMaterializer
implicit def system: ActorSystem
def log: LoggingAdapter
def authorize: Directive1[AccessToken] =
extractCredentials.flatMap {
case Some(OAuth2BearerToken(token)) =>
onComplete(verifyToken(token)).flatMap {
case Success(Some(t)) =>
case _ =>
log.warning(s"token $token is not valid")
case _ =>
log.warning("no token present in request")
def verifyToken(token: String): Future[Option[AccessToken]] = ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.