In Play 2.4 with DI, how to use a service class in “Secured” trait?
问题 Here's an authorisation example from Play Documentation (version 2.0.4; I tried to find a newer version of this document but couldn't): trait Secured { def username(request: RequestHeader) = request.session.get(Security.username) def onUnauthorized(request: RequestHeader) = Results.Redirect(routes.Auth.login) def withAuth(f: => String => Request[AnyContent] => Result) = { Security.Authenticated(username, onUnauthorized) { user => Action(request => f(user)(request)) } } def withUser(f: User =>