Play Scala 2.3.x - Integrate SecureSocial or Sihouette in Deadbolt

I am trying to use Deadbolt for authentication and Silhouette or SecureSocial for authentication using Play 2.3.3 and Scala 2.11.1.

MyDeadboltHandler has a getSubject to override and for this I need to extract the user from the request. Using SecureSocial 2 was pretty simple.

override def getSubject[A](request: Request[A]): Option[Subject] = { SecureSocial.currentUser(request) match { case Some(identity) => // Subject could be created and returned case _ => None } 

I can not find any method in Silhouette to get the "current user". Silhouette and SecureSocial also have SecuredRequest [AnyContent] (extended WrappedRequest), and the getRequest method in MyDeadboltHandler expects Request [A]. SecuredRequest is defined in a dash that is not visible in MyDeadboltHandler.

Any advice is highly appreciated.

+5
source share

Source: https://habr.com/ru/post/1201489/


All Articles