10BC0 Add DummyProvider for quick password based auth by MridulS · Pull Request #4684 · holoviz/panel · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@MridulS
Copy link
Contributor
@MridulS MridulS commented Apr 23, 2023

This hopefully gives a solution of quick password based authentication. No need to setup a full fledged OAuth app.

This fixes #2575 and also addresses https://discourse.holoviz.org/t/tips-guide-on-creating-a-simple-username-password-auth-for-panel-app/2582/13.

The PR adds 2 config options: --dummy-auth and --dummy-login-template. With --dummy-auth user can set the password and with --dummy-login-template they can override the default user login page (which I stole from https://github.com/bokeh/bokeh/tree/branch-3.2/examples/server/app/server_auth).

An example how to use this:

$ panel serve --dummy-auth "panel" --cookie-secret "SECRET" .......

This should open up something like:

Screenshot 2023-04-24 at 1 29 32 AM

I also changed couple of things in auth.py let me know if I should make another PR instead:

TODO:

  • Add to Authentication docs
  • Maybe add an example test for dummy auth?

@codecov
Copy link
codecov bot commented Apr 23, 2023

Codecov Report

Merging #4684 (a2c47ab) into main (e812632) will decrease coverage by 12.68%.
The diff coverage is 54.03%.

@@             Coverage Diff             @@
##             main    #4684       +/-   ##
===========================================
- Coverage   83.16%   70.49%   -12.68%     
===========================================
  Files         266      267        +1     
  Lines       37453    37531       +78     
===========================================
- Hits        31148    26456     -4692     
- Misses       6305    11075     +4770     
Flag Coverage Δ
ui-tests ?
unitexamples-tests 70.49% <54.03%> (-2.76%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/auth.py 37.07% <24.00%> (-1.41%) ⬇️
panel/command/serve.py 38.61% <30.00%> (+0.14%) ⬆️
panel/tests/ui/test_auth.py 50.00% <50.00%> (ø)
panel/tests/util.py 82.65% <80.95%> (-9.16%) ⬇️
panel/config.py 68.62% <100.00%> (+0.43%) ⬆️
panel/io/resources.py 84.08% <100.00%> (+0.04%) ⬆️
panel/tests/command/test_serve.py 100.00% <100.00%> (+10.61%) ⬆️

... and 70 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@philippjfr
Copy link
Member

Love this, thanks @MridulS! Some docs would indeed be nice, on the naming side I think we can name this something like SimpleAuth. Some other thoughts:

  • Might be nice to allow the user to specify a json or yaml file with username: password pairs

Adding tests would also be nice, think the best way is probably just a UI/integration test (using playwright) that starts a server and then goes through the login flow.

@MarcSkovMadsen
Copy link
Collaborator

BasicAuth could be an alternative to SimpleAuth. In user forums people use the term "basic" rather than "simple" when searching for this type of auth.

@philippjfr
Copy link
Member

Renamed to BasicAuth, added docs and added a test.

@philippjfr philippjfr merged commit 179aa16 into holoviz:main Apr 25, 2023
@philippjfr
Copy link
Member

Thanks @MridulS!

@MridulS
Copy link
Contributor Author
MridulS commented Apr 25, 2023

Wohoo! Thanks @philippjfr

@cdeil
Copy link
Contributor
cdeil commented Apr 25, 2023

This is cool. Thanks!

Why does it not show up in the dev docs yet?
https://pyviz-dev.github.io/panel/how_to/authentication/index.html

@cdeil cdeil mentioned this pull request Apr 26, 2023
@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simple login/password auth example without oauth

4 participants

0