Silhouette WebSocket authorization

81 views
Skip to first unread message

jawad ezzahraoui

unread,
May 13, 2016, 7:22:15 AM5/13/16
to Silhouette
Hi,

I'm using Authorization object to check user authorization for my actions:

def action = SecuredAction(WithRole(role)).async{}

How can I do it for my socket using: 

def socket = WebSocket.tryAcceptWithActor[String, String] {}

Thanks,

Christian Kaps

unread,
May 16, 2016, 1:20:59 PM5/16/16
to Silhouette
Hi,

you can pass your `Authorization` instance to the `SecuredRequestHandler`:

Best regards,
Christian 

jawad ezzahraoui

unread,
Jun 3, 2016, 11:38:56 AM6/3/16
to Silhouette
Hi,

I didn't find any example of how to do it with `SecuredRequestHandler`, can you please provide a little code example ?

Christian Kaps

unread,
Jun 4, 2016, 1:52:40 PM6/4/16
to Silhouette
Hi,

The `SecuredRequestHandler` has an apply method which accepts an `Authorization` instance. So you can write something like this:

SecuredRequestHandler(WithRole(role))


Best regards,
Christian
Reply all
Reply to author
Forward
0 new messages