Integrating Silhouette and Deadbolt (for authorziation)

I’m trying to use Silhouette (for authentication) along with Deadbolt (for authorization). However I’m having difficulty in integrating both together. If I’ve independent implementations, the code in my controller would resemble the below.

// Silhouette implementation - ensure that user exists
def deleteUser = securedAction.async { implicit securedRequest => ...

// Deadbolt implementation - user with admin role can delete
def deleteUser = deadboltAction.Restrict(Array("admin")) { authenticatedRequest => ...

To integrate the two concepts, I would like to do something along these lines:

if (securedAction)
  if (deadboltAction)
    delete user
  else
    delete action forbidden
else
  invalid user

Based on my understanding of Action Compositions in the Play Framework, the pseudo code would roughly translate to:

def deleteUser = securedAction.andThen(deadboltAction.Restrict(Array("admin")).async { request => ...

The above code of course will not compile due to type mismatch. Given the type for the Restrict function, how can I achieve the desired outcome?

I found this post by Deadbolt’s author. Based on my understanding, there isn’t a way to chain the actions and hence only one of the modules i.e. either Silhouette or Deadbolt can be used at a time but not both. An alternative approach, as proposed in the post, is to copy/paste some code from Silhouette, which I’m not keen to do. Hence I’ve decided to create my own simplified version for the authorization module to fit my needs. I should also add that one integrate with Silhouette’s authorization too.