Authentication with Keycloak and Bokeh instance on Tornado

I am attempting to set up authentication with my Bokeh Server instance that runs on Tornado as per the example on flask_embed.py. It is run with the command python3 main.py.

As per described on the docs, I need to create a module which should provide certain functions that should be used for authentication. However, I have no idea of how to properly connect a OpenID Keycloak instance with Bokeh running on Tornado, so anything that would point me in the right direction would be of great help. If I could see an example of a Bokeh Server application running with an auth module that would be splendid.

Thanks in advance :3

I have no experience with Keycloak so I can’t comment anything directly about that at all. Bokeh’s auth hooks are really just very thin wrapper’s around the hooks that Tornado itself provides, so you might actually be able to find useful information by searching more generally for guidance about integrating Keycloak with Tornado.

The Bokeh repo only has the toy example that I know of. However, the Panel project, which is built on Bokeh, provides auth integrations for at least a few common auth systems. You might find useful code to refer to in the Bokeh auth hooks that they implement for these. Maybe @Philipp_Rudiger or @James_A_Bednar1 can provide some more specific pointers into their codebase.

1 Like

Thank you for the response!
I will de checking out the Panel authentication implementation and their docs in order to see how they’ve made it work.

Thanks again for the help!