panel icon indicating copy to clipboard operation
panel copied to clipboard

feat: add PAM authenticator

Open pgierz opened this issue 1 year ago • 3 comments

Hi Panel Team,

I built a very simple PAM authenticator, and it seems to work provided you have given the correct environmental variables. Here is an example, assuming you have an app named app.py. For demonstration, I just use the md5 sum of the program code:

$ export PANEL_OAUTH_KEY=$(md5 -q app.py)
$ export PANEL_OAUTH_SECRET=$(panel secret)
$ export PANEL_OAUTH_PROVIDER=pam
$ export PANEL_OAUTH_ENCRYPTION=$(panel oauth-secret)
$ export PANEL_COOKIE_SECRET=$(panel oauth-secret)  # Twice, gives unique secret each call
$ panel serve app.py

Or in one line:

$ PANEL_OAUTH_KEY=$(md5 -q app.py) PANEL_OAUTH_SECRET=$(panel secret) PANEL_OAUTH_PROVIDER=pam PANEL_OAUTH_ENCRYPTION=$(panel oauth-secret) PANEL_COOKIE_SECRET=$(panel oauth-secret) panel serve app.py

Maybe someone else finds this useful.

pgierz avatar May 22 '24 12:05 pgierz

I moved the the Pamela import to be a optional dependency and changed the inclusion in the pyproject.toml file.

I haven't contributed to the documentation before, is there a best practices guideline for that?

pgierz avatar May 29 '24 12:05 pgierz

Regarding best practice for documentation. We are guided by the Diataxis framework for technical documentation https://diataxis.fr/. You might see something non-consistent in practice - either for historical reasons or because we don't yet understand well enough to write according to Diataxis.

What I would recommend doing is looking at the documentation for other OAuth Providers and then making a similar contribution. You are very welcome to make a quick draft and ask for some guidance.

MarcSkovMadsen avatar Jun 03 '24 16:06 MarcSkovMadsen

Hi @pgierz . Cool feature! OAuth docs are here:

https://panel.holoviz.org/how_to/authentication/providers.html

A quick draft that describes the core functionality would be a great start!

Coderambling avatar Jun 03 '24 16:06 Coderambling

Thanks again @pgierz, I finally got around to this and added some docs. Will merge.

philippjfr avatar Jan 22 '25 18:01 philippjfr

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 09 '25 16:09 github-actions[bot]