Ask a Question

Is there a sample application?

I am trying to implement Deadbolt into a Scala application, I realise the code in the guide is an example but am having a hard time going through the guide and working out where everything needs to go in my application. Any chance of a simple sample application for just a couple of routes?

Enabling two factor authentication

How to integrate two factor authentication using deadbolt?

Mixing Deadbolt with Play cached Actions

https://www.playframework.com/documentation/2.6.x/ScalaCache#Caching-HTTP-responses Any advice on how best to mix the two in a controller function? e.g. ```scala def aCacheableResponse(id: String) = deadbolt.SubjectPresent()() { implicit request => cached((_: RequestHeader) => s"something.$id", 1.hour) { Action.async { //do some stuff here, get a future result } } } ``` doesnt work, but is there something similar to this I can try?

Empty request body in tests

I have a POST request that contains some data I need to inspect before deciding which deadbolt dynamic constraint to use, so I'm parsing the request body using Play's action builder Action.async(parse.json) and then calling one of two dynamic handlers based on the content. Invoking the endpoint with curl works as expected, however in my integration tests the deadbolt actions fail with a 'Invalid Json: No content to map due to end-of-input' error. I've got a feeling that this is due to the controller stubbing in Play tests but is there anything in deadbolt that could effect the tests in this way?

Scala documentation is out of date

Hi Steve, the documentation is obviously out of date: https://deadbolt-scala.readme.io/docs/template-constraints as 'restrict' is no longer an object I can't figure out how to make TWIRL magic work, simple changing @import be.objectify.deadbolt.scala.views.html.restrict to @import be.objectify.deadbolt.scala.views.html.di.restrict evidently does not work as an instance of 'restrict' object must be dependency injected somehow. Will be nice if the documentation is updated with appropriate examples. Thanks

Any plans on supporting Play 2.6

Hi! It looks like something with the BodyParser has changed in Play 2.6 that causes errors when using Deadbolt. Do you have any plans on supporting 2.6? I know that I'm a bit early with testing a new Play version.

How to compose an Action for multipart upload with Subject Present?

First, Steve, excellent library. Kudo! I just love Deadbolt! However, I haven't figured this out: @ https://www.playframework.com/documentation/2.5.x/ScalaFileUpload describes how to upload a file from the browser: def upload = Action(parse.multipartFormData) { request => ... } How would you compose a deadbolt subject present action with parse.multipartFormData starting from : def logoUploadPost = actionBuilder.SubjectPresentAction().defaultHandler() { implicit request => ... } It seems like it's too late to provide the alternate parser... Maybe something in the Dynamic arena? Thanks much...

What would be the best way to handle JWT authenticator idle expiration?

I would like to handle idle expiration by updating the tokens with every request, so essentially touch the validated token and send it back with the result. How can I avoid having to parse the token twice, once in the DeadboltHandler to authorize the request, and the second time in the action body to send the updated token back?

Request body is of type Nothing

Hi! Usually I can use request.body.asJson to get the data passed to my action. But when I'm using Deadbolt I get a "be.objectify.deadbolt.scala.AuthenticatedRequest" where body is "Nothing" and "AnyContent" when not using Deadbolt. I guess that I'm supposed to be able to reach the body even if I'm using Deadbolt, right? Snippet of the code: class Application @Inject()(deadbolt: DeadboltActions) extends Controller { def search = deadbolt.SubjectPresent()() { authRequest => Future { var currentUser: User = authRequest.subject.get.asInstanceOf[User] // authRequest.body.asJson Ok("Hello " + currentUser.name) } } }

How deadbolt 2.4.4 integrate with Play-Framework 2.3.10

Hello Team, I am trying to integrate Deadbolt with my application, but my application is build upon Play-Framework 2.3.10 and deadbolt old versions are now deprecated. It is difficult for us to migrate our project to new version. How can we integrate, deadbolt with our play-framework version.