Why does authorize directive execute after the code it's supposed to protect?
问题 I am using Scala 2.11.2, Akka 2.3.6 and Spray 1.3.2. I'm facing an issue with the authorize directive. Here is the interesting part of the code: val authenticatorActor = context.actorOf(Props[AuthenticatorActor]) implicit val timeout = Timeout(5 seconds) cookie("userName") { cookie => def optionUser = Await.result(authenticatorActor ? cookie.content, timeout.duration).asInstanceOf[Option[User]] authorize(isAuthorized(optionUser)) { // ????? val user = optionUser.get //do stuff } } def