Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to define authorization callback #3777

Merged
merged 4 commits into from
Aug 24, 2022
Merged

Conversation

philippjfr
Copy link
Member

Currently our authentication simply authorizes users based on whether they have been given permissions in the OAuth provider configuration. Often times this is controlled by IT or is otherwise difficult to manage so its often easier to grant permissions to use the OAuth provider freely but then restrict usage in the application itself. If you want to do this you currently have to validate the pn.state.user or pn.state.user_info yourself and then modify your application based on whether the user is authorized or not.

To make this simpler we introduce a pn.config.authorize_callback which is given the user_info dictionary and returns True or False depending on whether the user should be authorized.

@codecov
Copy link

codecov bot commented Aug 23, 2022

Codecov Report

Merging #3777 (1032197) into master (70fa6fb) will decrease coverage by 49.62%.
The diff coverage is 20.68%.

@@             Coverage Diff             @@
##           master    #3777       +/-   ##
===========================================
- Coverage   83.44%   33.82%   -49.63%     
===========================================
  Files         214      214               
  Lines       31426    31430        +4     
===========================================
- Hits        26224    10631    -15593     
- Misses       5202    20799    +15597     
Flag Coverage Δ
ui-tests 33.82% <20.68%> (-0.03%) ⬇️
unitexamples-tests ?

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

Impacted Files Coverage Δ
panel/command/serve.py 15.00% <8.33%> (-22.12%) ⬇️
panel/io/server.py 22.56% <10.00%> (-54.04%) ⬇️
panel/auth.py 39.20% <25.00%> (-0.15%) ⬇️
panel/config.py 45.87% <100.00%> (-14.35%) ⬇️
panel/io/logging.py 100.00% <100.00%> (ø)
panel/__main__.py 0.00% <0.00%> (-100.00%) ⬇️
panel/models/katex.py 0.00% <0.00%> (-100.00%) ⬇️
panel/models/mathjax.py 0.00% <0.00%> (-100.00%) ⬇️
panel/models/perspective.py 0.00% <0.00%> (-100.00%) ⬇️
panel/pane/vtk/synchronizable_deserializer.py 0.00% <0.00%> (-97.59%) ⬇️
... and 157 more

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

@philippjfr philippjfr merged commit be3c59a into master Aug 24, 2022
@philippjfr philippjfr deleted the authorize_callback branch August 24, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant