You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add authorization layer to server request handlers (#165)
* add authorization layer to request handlers
* update authorized wrapper with resource
* Add tests
* Add documentation
* Add AuthorizationManager class
* Update examples/authorization/README.md
* authorization: address review
- "contents" applies to /view
- "terminals" is plural
- "server" is scope for shutdown
- failed authorization is 403, not 401
- calling it Authorizer instead of AuthorizationManager
- 'user' term is more broadly understood than 'subject'.
Plus, it always comes from `self.current_user`.
- default authorizer that allows all users is AllowAllAuthorizer
* allow `@authorized` to be used with no arguments
- use auth_resource on handler
- use http method name for action
* Structure authorization resources as a table
* Move Authorizer to existing jupyter_server.auth
since it's a public API packages should import,
let's not nest it deep in services.auth.authorizer
Co-authored-by: David Brochart <[email protected]>
Co-authored-by: Steven Silvester <[email protected]>
Co-authored-by: Min RK <[email protected]>
# Authorization in a simple Jupyter Notebook Server
2
+
3
+
This folder contains the following examples:
4
+
5
+
1. a "read-only" Jupyter Notebook Server
6
+
2. a read/write Server without the ability to execute code on kernels.
7
+
3. a "temporary notebook server", i.e. read and execute notebooks but cannot save/write files.
8
+
9
+
## How does it work?
10
+
11
+
To add a custom authorization system to the Jupyter Server, you will need to write your own `Authorizer` subclass and pass it to Jupyter's configuration system (i.e. by file or CLI).
12
+
13
+
The examples below demonstrate some basic implementations of an `Authorizer`.
14
+
15
+
```python
16
+
from jupyter_server.auth import Authorizer
17
+
18
+
19
+
classMyCustomAuthorizer(Authorizer):
20
+
"""Custom authorization manager."""
21
+
22
+
# Define my own method here for handling authorization.
23
+
# The argument signature must have `self`, `handler`, `user`, `action`, and `resource`.
0 commit comments