I have a directive, defined like
def allowedRoles(roles: UserRole*)(implicit login: Login): Directive0 = ???
But I don;t seem to be able to use it in without having to explicitly pass in the login
parameter
def myRoutes(implicit req: HttpRequest, login: Login) = {
path("example" / "path") {
get {
allowedRoles(Administrator) { // ← fails
handleGet
}
}
}
}
if I try to compile this it fails with a type mismatch:
[error] found : akka.http.scaladsl.server.Route
[error] (which expands to) akka.http.scaladsl.server.RequestContext => scala.concurrent.Future[akka.http.scaladsl.server.RouteResult]
[error] required: com.example.Login
[error] allowedRoles(Administrator) { handleGet } }
if I change the marked line to allowedRoles(Administrator)(login)
then it works, but it seems like I should not need to do this, what am I missing?