mkurz / deadbolt-2-scala

Idiomatic Scala API for Deadbolt 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting the subject from the request within a Composite Action?

koadr opened this issue · comments

I switched my deadbolt action from one that just restricted roles

deadbolt.Restrict(allOfGroup("foo"))() { authRequest =>
  Future {
    Ok(authRequest.subject.map(_.identifier))
  }
}

to another that leverages composite actions

 deadbolt.Composite(
       constraint = constraints.ConstraintTree[A](||(ec),
                                                  List(constraints.Restrict(allOfGroup("foo")),
                                                       constraints.Pattern("killer.undead.zombie",
                                                                           PatternType.REGEX))))(){authRequest =>
  Future {
    Ok(authRequest.subject.map(_.identifier))
  }}

It appears for the composite case the request is never supplied with the subject (First case returns the identifier and the second case doesn't). Am I doing something wrong? In my case I need the identifier for downstream operations.

Thanks for the report. I'll get this fixed asap.

Fixed in 2.5.1