-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[play-2.2.x] WebSocket authorization support #26
Comments
I think to support the authorization for WebSocket is good. Play If we support the authorization on We need to think the name for the new method. e.g. |
Yep, that would be awesome. It's sad that play 2.2.x doesn't have I can work on this PR if you allow me. Nevertheless, do you think we should still add support for this feature to the play-2.2.x version? For the name of the method i think |
I don't think to add support except a critical bug to the play-2.2.x version.
I reconsidered that after a day, it is good to create another provider named Because, WebSocket of Playframework requires We will support I hope your example will be changed to like the below.
|
I'm going to try this feature after release version 0.9.0 and 0.7.4. |
Yes, making another trait is better, but it should extends the Async trait because if not the controller cannot have protected actions that does not uses WebSockets. Also, i think that it would be nice to provide a method that doesn't require a function body, instead just give to the client an Either if the user is or is not authenticated. This is inspired by the authorized method in Play2-Auth framework. I took this is snippet from the issue 51 of the Play2-auth object WSController extends Controller with AsyncAuth with AuthConfigImpl {
def chat = WebSocket.async[JsValue] { implicit request =>
authorized(NormalUser).map {
case Right(user) => ChatRoom.join(user.username)
case Left(_) => // return authentication/authorization failed response
}
}
} So, providing something like this would be great. def authorized[A, U](dataHandler: DataHandler[U])(implicit request: RequestHeader): Future[Either[OAuthError, AuthInfo[U]]] =
ProtectedResource.handleRequest(request, dataHandler) |
Ok Besides, you can count on me if you need an extra hand to develop this feature. |
I think you directly use Existing OAuth2Provider provides callback and creating failed response interface. |
@tsuyoshizawa How is this going? Do you still have plan to support websocket with play2? |
@lequangdzung Yes. I have plan to support this using Do you want this as soon as possible? |
Hi 😄
Is there already any kind of support for WebSocket based actions?
I had made something like this to make it work here.
Controller:
If there isn't, do you plan to support it or we should just use the ProtectedResource class?
ProtectedResource.handleRequest(request, dataHandler)
The text was updated successfully, but these errors were encountered: