gakuzzzz on play2.7
play2.7 (compare)
gakuzzzz on play2.7
play2.7 (compare)
gakuzzzz on play2.6
temp (compare)
gakuzzzz on play2.6
temp commit (compare)
gakuzzzz on play2.6
Change withLoggedIn signature t… (compare)
[warn] /Users/plamb/Documents/Personal/Coding/portlandpaella/app/controllers/auth/AuthConfigImpl.scala:32: method maybeApplication in object Play is deprecated: This is a static reference to application, use DI instead
[warn] cookieSecureOption = play.api.Play.maybeApplication.exists(app => play.api.Play.isProd(app)),
[warn] ^
[warn] /Users/plamb/Documents/Personal/Coding/portlandpaella/app/controllers/auth/AuthConfigImpl.scala:32: method isProd in object Play is deprecated: inject the play.api.Environment instead
[warn] cookieSecureOption = play.api.Play.maybeApplication.exists(app => play.api.Play.isProd(app)),
user
information in the loginSucceeded
method?
Hi!
I'm trying to use play2-auth also for my websocket controller but I don't see a way to conveniently get the session ID for a logged in user. I am now overwriting a lot of methods / writing my own classes already. Is there a built-in support or a different module that handles this in a good way? I need the session ID because I need to cut the websocket connection on logout.
Thanks!
Controller with AsyncAuth {
def socket: WebSocket = WebSocket.acceptOrResult[String, String] { implicit request =>
authorized(isLoggedIn).map {
case Left(_) => Left(Forbidden)
case Right((user, _)) =>
Right {
ActorFlow.actorRef(out => {
actorManager.agentWebsocketServer ! (out, user.id.get)
AgentClientActor.props(out, actorManager, user)
})
}
}
}
}
AuthConfig
contains three type aliases, which made it difficult to make that component (and basically all others) difficult to inject and runtime and also know about the correct types at compile time. Using a type parameter (same trick that play-silhouette uses) cut down on the required boilerplate, but I couldn't find a way to make it work without guice.
TypeLiteral
bindings in the module.