[Libwebsockets] Libwebsocket with Keycloak Integration

Marcel Isenbügel M.Isenbuegel at smart4energy.com
Wed Apr 10 09:04:58 CEST 2019


Hey everyone,

I’m interested to implement an authentication system to Websockets.

So they are two different ways.


1.       After upgrading to ws conncetion start an authorisation

2.       On the HTTP Request test the authorization

So I want to implement the second way. A Bearer Token will be send in the http request. Is there a easy way to catch that token and check it against a keycloak server.

I think I have to extract the http header when

LWS_CALLBACK_HTTP  is called ?

The Token is in the header => Authorization: Bearer <token>


How can I get this token ?

On Success upgrade to ws
On Error decline connection

Is this a right and good way to implement this ? If someone has an example it would be nice to see how it can works.

Best regards

Marcel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20190410/f2510e8c/attachment.htm>


More information about the Libwebsockets mailing list