jupyter-server / jupyter_server

The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.
https://jupyter-server.readthedocs.io
BSD 3-Clause "New" or "Revised" License
489 stars 308 forks source link

Support async Authorizers #1373

Closed Zsailer closed 11 months ago

Zsailer commented 11 months ago

Add support for asynchronous Authorizers.

This is feature additive—it shouldn't affect standard, synchronous authorizers. This enables folks to make the is_authorized method asynchronous which is particularly useful for fetching authorization status from an external auth provider.

blink1073 commented 11 months ago
 tests/auth/test_authorizer.py:241: in AsyncAuthorizerTest
    ) -> Awaitable | bool:
E   TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'type'

Probably need a from __future__ import annotations in that file.

Zsailer commented 11 months ago

I think I fixed it by being more explicit about what the Awaitable returns 😃