playframeworkplayframework-2.0deadbolt

Handle Future[User] in Deadbolt's getSubject


Is there a way in Deadbolt to use Future[User] in MyDeadboltHandler's getSubject method without blocking?

Current method expects a request and returns an Option[Subject]

override def getSubject[A](request: Request[A]): Option[Subject] = {
  currentUser //<-- currentUser is a Future[User] 
  ....
}

Solution

  • I'll make this change for the next release of Deadbolt.

    Update: Version 2.3.2 of Deadbolt now gives you... Scala: Future[Option[Subject]] Java: F.Promise

    Additionally, this version is available via Maven Central so you don't need to specify the Objectify Repository resolver any more. Older versions still require the resolver.