dash-auth-async 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {dash_auth_async-1.2.0/dash_auth_async.egg-info → dash_auth_async-1.3.0}/PKG-INFO +97 -15
  2. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/README.md +96 -10
  3. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/__init__.py +9 -13
  4. dash_auth_async-1.3.0/dash_auth_async/_optional.py +24 -0
  5. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/auth.py +36 -14
  6. dash_auth_async-1.3.0/dash_auth_async/backends.py +869 -0
  7. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/basic_auth.py +61 -25
  8. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/group_protection.py +52 -29
  9. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/oidc_auth.py +153 -94
  10. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/public_routes.py +36 -15
  11. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async/quart_client.py +44 -9
  12. dash_auth_async-1.3.0/dash_auth_async/version.py +3 -0
  13. dash_auth_async-1.3.0/dash_auth_async/websocket_auth.py +271 -0
  14. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0/dash_auth_async.egg-info}/PKG-INFO +97 -15
  15. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async.egg-info/SOURCES.txt +1 -0
  16. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async.egg-info/requires.txt +0 -4
  17. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/pyproject.toml +53 -5
  18. dash_auth_async-1.2.0/dash_auth_async/backends.py +0 -160
  19. dash_auth_async-1.2.0/dash_auth_async/version.py +0 -1
  20. dash_auth_async-1.2.0/dash_auth_async/websocket_auth.py +0 -123
  21. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/LICENSE +0 -0
  22. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/MANIFEST.in +0 -0
  23. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async.egg-info/dependency_links.txt +0 -0
  24. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/dash_auth_async.egg-info/top_level.txt +0 -0
  25. {dash_auth_async-1.2.0 → dash_auth_async-1.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dash-auth-async
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Dash Authorization Package.
5
5
  Author-email: Jonas Schrage <119843859+joschrag@users.noreply.github.com>
6
6
  License: MIT
@@ -24,7 +24,6 @@ Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Programming Language :: Python :: 3.13
25
25
  Classifier: Programming Language :: Python :: 3.14
26
26
  Classifier: Topic :: Database :: Front-Ends
27
- Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
28
27
  Classifier: Topic :: Scientific/Engineering :: Visualization
29
28
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
30
29
  Classifier: Topic :: Software Development :: Widget Sets
@@ -33,11 +32,8 @@ Description-Content-Type: text/markdown
33
32
  License-File: LICENSE
34
33
  Requires-Dist: authlib>=1.7.2
35
34
  Requires-Dist: flask>=3.1.3
36
- Requires-Dist: requests[security]>=2.34.2
37
35
  Requires-Dist: werkzeug>=3.1.8
38
36
  Requires-Dist: dash>=2
39
- Provides-Extra: oidc
40
- Requires-Dist: authlib; extra == "oidc"
41
37
  Provides-Extra: fastapi
42
38
  Requires-Dist: dash[fastapi]>=4.2.0; extra == "fastapi"
43
39
  Provides-Extra: quart
@@ -70,17 +66,20 @@ How this fork compares to upstream [`dash-auth`](https://github.com/plotly/dash-
70
66
  | --- | :---: | :---: |
71
67
  | Flask backend | ✅ | ✅ |
72
68
  | Quart backend | ❌ | ✅ |
73
- | FastAPI backend | ❌ | 🚧 <sup>1</sup> |
74
- | Custom backends | ❌ | ✅ <sup>2</sup> |
69
+ | FastAPI backend | ❌ | ✅ |
70
+ | Custom backends | ❌ | ✅ <sup>1</sup> |
75
71
  | Protected / public callbacks | ✅ | ✅ |
76
- | Async callbacks | ❌ | ✅ <sup>3</sup> |
72
+ | Async callbacks | ❌ | ✅ <sup>2</sup> |
77
73
  | Authenticated WebSocket callbacks | ❌ | ✅ <sup>3</sup> |
78
74
 
79
- ✅ supported · 🚧 on the roadmap · ❌ not supported
75
+ ✅ supported · ❌ not supported
76
+
77
+ <sup>1</sup> `detect_backend` resolves Flask/Quart/FastAPI automatically; any other server is supported by supplying your own `Backend` instance.
78
+
79
+ <sup>2</sup> Provided by the Quart and FastAPI backends.
80
+
81
+ <sup>3</sup> Provided by the Quart and FastAPI backends. WebSocket auth is a no-op on Flask, which has no WebSocket callback transport.
80
82
 
81
- <sup>1</sup> A `dash-auth-async[fastapi]` extra is declared and a native FastAPI backend is on the roadmap. In the meantime you can support it by implementing the `Backend` ABC and passing `Auth(..., backend=MyBackend())`.
82
- <sup>2</sup> `detect_backend` resolves Flask/Quart automatically; any other server is supported by supplying your own `Backend` instance.
83
- <sup>3</sup> Provided by the Quart backend. WebSocket auth is a no-op on Flask, which has no WebSocket callback transport.
84
83
 
85
84
  For local testing, install [uv](https://docs.astral.sh/uv/getting-started/installation/), then install the dev dependencies and run individual tests:
86
85
 
@@ -325,7 +324,22 @@ if __name__ == "__main__":
325
324
  app.run(debug=True)
326
325
  ```
327
326
 
328
- ### Quart (async) Backend
327
+ ### Async backends
328
+
329
+ #### Known Limitations
330
+
331
+ > **⚠️ WebSocket callbacks & auth:**
332
+ > Do **not** enable `websocket_callbacks=True`
333
+ > globally on an authenticated `use_pages` app. The global flag routes *every*
334
+ > callback — including Dash's built-in page-routing callback — over the WebSocket,
335
+ > which bypasses the HTTP `before_request` auth guard where the login challenge is
336
+ > issued. Navigating to a protected page then hangs (the socket closes with `4401`
337
+ > and reconnect-loops) instead of prompting for login — the prompt appears only after
338
+ > a full page reload. Opt **individual** streaming callbacks into `websocket=True`
339
+ > instead, so routing and login stay on HTTP.
340
+
341
+
342
+ #### Quart (async) Backend
329
343
 
330
344
  `dash-auth-async` supports [Dash's Quart backend](https://dash.plotly.com/) for fully async request handling.
331
345
  Install the `quart` extra to pull in the required dependencies:
@@ -337,7 +351,7 @@ pip install dash-auth-async[quart]
337
351
  Then pass `backend="quart"` when creating your Dash app. The auth setup is identical
338
352
  to the Flask examples above — no code changes required beyond the backend flag.
339
353
 
340
- #### BasicAuth with Quart
354
+ ##### BasicAuth with Quart
341
355
 
342
356
  ```python
343
357
  from dash import Dash
@@ -351,7 +365,7 @@ if __name__ == "__main__":
351
365
  app.run(host="127.0.0.1", port=8050, debug=True)
352
366
  ```
353
367
 
354
- #### OIDCAuth with Quart
368
+ ##### OIDCAuth with Quart
355
369
 
356
370
  ```python
357
371
  import os
@@ -381,6 +395,74 @@ if __name__ == "__main__":
381
395
 
382
396
  > **Note:** The Quart backend requires Dash >= 4.2.0 and Python >= 3.10.
383
397
 
398
+ #### FastAPI (async) Backend
399
+
400
+ `dash-auth-async` supports [Dash's FastAPI backend](https://dash.plotly.com/) too.
401
+ Install the `fastapi` extra to pull in the required dependencies:
402
+
403
+ ```
404
+ pip install dash-auth-async[fastapi]
405
+ ```
406
+
407
+ Then pass `backend="fastapi"` when creating your Dash app. `BasicAuth` and
408
+ `OIDCAuth` work exactly as on Flask/Quart — no code changes beyond the backend flag.
409
+
410
+ ##### BasicAuth with FastAPI
411
+
412
+ ```python
413
+ from dash import Dash
414
+ from dash_auth_async import BasicAuth
415
+
416
+ app = Dash(__name__, backend="fastapi")
417
+
418
+ BasicAuth(
419
+ app,
420
+ {"admin": "admin", "viewer": "viewer123"},
421
+ secret_key="aStaticSecretKey!", # enables sessions (SessionMiddleware)
422
+ )
423
+
424
+ if __name__ == "__main__":
425
+ app.run(host="127.0.0.1", port=8050, debug=True)
426
+ ```
427
+
428
+ ##### OIDCAuth with FastAPI
429
+
430
+ ```python
431
+ import os
432
+ from dash import Dash, html
433
+ from dash_auth_async import OIDCAuth
434
+
435
+ app = Dash(__name__, backend="fastapi")
436
+
437
+ app.layout = html.Div([
438
+ html.H2("OIDCAuth + FastAPI"),
439
+ html.A("Logout", href="/oidc/logout"),
440
+ ])
441
+
442
+ auth = OIDCAuth(app, secret_key="aStaticSecretKey!")
443
+ auth.register_provider(
444
+ "myidp",
445
+ client_id=os.environ["OIDC_CLIENT_ID"],
446
+ client_secret=os.environ["OIDC_CLIENT_SECRET"],
447
+ server_metadata_url=os.environ["OIDC_METADATA_URL"],
448
+ token_endpoint_auth_method="client_secret_post",
449
+ client_kwargs={"scope": "openid email profile"},
450
+ )
451
+
452
+ if __name__ == "__main__":
453
+ app.run(host="127.0.0.1", port=8050, debug=True)
454
+ ```
455
+
456
+ Notes:
457
+
458
+ - A `secret_key` installs Starlette's `SessionMiddleware` automatically. If you
459
+ add your own `SessionMiddleware`, `dash-auth-async` defers to it.
460
+ - `Auth`/`OIDCAuth` must be constructed before the server starts serving
461
+ (Starlette forbids adding middleware after startup) — the normal usage pattern.
462
+ - OIDC uses authlib's official `starlette_client`; no extra client module required.
463
+
464
+ > The FastAPI backend requires Dash >= 4.2.0 and Python >= 3.10.
465
+
384
466
  ### User-group-based permissions
385
467
 
386
468
  `dash_auth_async` provides a convenient way to secure parts of your app based on user groups.
@@ -21,17 +21,20 @@ How this fork compares to upstream [`dash-auth`](https://github.com/plotly/dash-
21
21
  | --- | :---: | :---: |
22
22
  | Flask backend | ✅ | ✅ |
23
23
  | Quart backend | ❌ | ✅ |
24
- | FastAPI backend | ❌ | 🚧 <sup>1</sup> |
25
- | Custom backends | ❌ | ✅ <sup>2</sup> |
24
+ | FastAPI backend | ❌ | ✅ |
25
+ | Custom backends | ❌ | ✅ <sup>1</sup> |
26
26
  | Protected / public callbacks | ✅ | ✅ |
27
- | Async callbacks | ❌ | ✅ <sup>3</sup> |
27
+ | Async callbacks | ❌ | ✅ <sup>2</sup> |
28
28
  | Authenticated WebSocket callbacks | ❌ | ✅ <sup>3</sup> |
29
29
 
30
- ✅ supported · 🚧 on the roadmap · ❌ not supported
30
+ ✅ supported · ❌ not supported
31
+
32
+ <sup>1</sup> `detect_backend` resolves Flask/Quart/FastAPI automatically; any other server is supported by supplying your own `Backend` instance.
33
+
34
+ <sup>2</sup> Provided by the Quart and FastAPI backends.
35
+
36
+ <sup>3</sup> Provided by the Quart and FastAPI backends. WebSocket auth is a no-op on Flask, which has no WebSocket callback transport.
31
37
 
32
- <sup>1</sup> A `dash-auth-async[fastapi]` extra is declared and a native FastAPI backend is on the roadmap. In the meantime you can support it by implementing the `Backend` ABC and passing `Auth(..., backend=MyBackend())`.
33
- <sup>2</sup> `detect_backend` resolves Flask/Quart automatically; any other server is supported by supplying your own `Backend` instance.
34
- <sup>3</sup> Provided by the Quart backend. WebSocket auth is a no-op on Flask, which has no WebSocket callback transport.
35
38
 
36
39
  For local testing, install [uv](https://docs.astral.sh/uv/getting-started/installation/), then install the dev dependencies and run individual tests:
37
40
 
@@ -276,7 +279,22 @@ if __name__ == "__main__":
276
279
  app.run(debug=True)
277
280
  ```
278
281
 
279
- ### Quart (async) Backend
282
+ ### Async backends
283
+
284
+ #### Known Limitations
285
+
286
+ > **⚠️ WebSocket callbacks & auth:**
287
+ > Do **not** enable `websocket_callbacks=True`
288
+ > globally on an authenticated `use_pages` app. The global flag routes *every*
289
+ > callback — including Dash's built-in page-routing callback — over the WebSocket,
290
+ > which bypasses the HTTP `before_request` auth guard where the login challenge is
291
+ > issued. Navigating to a protected page then hangs (the socket closes with `4401`
292
+ > and reconnect-loops) instead of prompting for login — the prompt appears only after
293
+ > a full page reload. Opt **individual** streaming callbacks into `websocket=True`
294
+ > instead, so routing and login stay on HTTP.
295
+
296
+
297
+ #### Quart (async) Backend
280
298
 
281
299
  `dash-auth-async` supports [Dash's Quart backend](https://dash.plotly.com/) for fully async request handling.
282
300
  Install the `quart` extra to pull in the required dependencies:
@@ -288,7 +306,7 @@ pip install dash-auth-async[quart]
288
306
  Then pass `backend="quart"` when creating your Dash app. The auth setup is identical
289
307
  to the Flask examples above — no code changes required beyond the backend flag.
290
308
 
291
- #### BasicAuth with Quart
309
+ ##### BasicAuth with Quart
292
310
 
293
311
  ```python
294
312
  from dash import Dash
@@ -302,7 +320,7 @@ if __name__ == "__main__":
302
320
  app.run(host="127.0.0.1", port=8050, debug=True)
303
321
  ```
304
322
 
305
- #### OIDCAuth with Quart
323
+ ##### OIDCAuth with Quart
306
324
 
307
325
  ```python
308
326
  import os
@@ -332,6 +350,74 @@ if __name__ == "__main__":
332
350
 
333
351
  > **Note:** The Quart backend requires Dash >= 4.2.0 and Python >= 3.10.
334
352
 
353
+ #### FastAPI (async) Backend
354
+
355
+ `dash-auth-async` supports [Dash's FastAPI backend](https://dash.plotly.com/) too.
356
+ Install the `fastapi` extra to pull in the required dependencies:
357
+
358
+ ```
359
+ pip install dash-auth-async[fastapi]
360
+ ```
361
+
362
+ Then pass `backend="fastapi"` when creating your Dash app. `BasicAuth` and
363
+ `OIDCAuth` work exactly as on Flask/Quart — no code changes beyond the backend flag.
364
+
365
+ ##### BasicAuth with FastAPI
366
+
367
+ ```python
368
+ from dash import Dash
369
+ from dash_auth_async import BasicAuth
370
+
371
+ app = Dash(__name__, backend="fastapi")
372
+
373
+ BasicAuth(
374
+ app,
375
+ {"admin": "admin", "viewer": "viewer123"},
376
+ secret_key="aStaticSecretKey!", # enables sessions (SessionMiddleware)
377
+ )
378
+
379
+ if __name__ == "__main__":
380
+ app.run(host="127.0.0.1", port=8050, debug=True)
381
+ ```
382
+
383
+ ##### OIDCAuth with FastAPI
384
+
385
+ ```python
386
+ import os
387
+ from dash import Dash, html
388
+ from dash_auth_async import OIDCAuth
389
+
390
+ app = Dash(__name__, backend="fastapi")
391
+
392
+ app.layout = html.Div([
393
+ html.H2("OIDCAuth + FastAPI"),
394
+ html.A("Logout", href="/oidc/logout"),
395
+ ])
396
+
397
+ auth = OIDCAuth(app, secret_key="aStaticSecretKey!")
398
+ auth.register_provider(
399
+ "myidp",
400
+ client_id=os.environ["OIDC_CLIENT_ID"],
401
+ client_secret=os.environ["OIDC_CLIENT_SECRET"],
402
+ server_metadata_url=os.environ["OIDC_METADATA_URL"],
403
+ token_endpoint_auth_method="client_secret_post",
404
+ client_kwargs={"scope": "openid email profile"},
405
+ )
406
+
407
+ if __name__ == "__main__":
408
+ app.run(host="127.0.0.1", port=8050, debug=True)
409
+ ```
410
+
411
+ Notes:
412
+
413
+ - A `secret_key` installs Starlette's `SessionMiddleware` automatically. If you
414
+ add your own `SessionMiddleware`, `dash-auth-async` defers to it.
415
+ - `Auth`/`OIDCAuth` must be constructed before the server starts serving
416
+ (Starlette forbids adding middleware after startup) — the normal usage pattern.
417
+ - OIDC uses authlib's official `starlette_client`; no extra client module required.
418
+
419
+ > The FastAPI backend requires Dash >= 4.2.0 and Python >= 3.10.
420
+
335
421
  ### User-group-based permissions
336
422
 
337
423
  `dash_auth_async` provides a convenient way to secure parts of your app based on user groups.
@@ -1,24 +1,20 @@
1
- from .public_routes import add_public_routes, public_callback
2
- from .basic_auth import BasicAuth
3
- from .group_protection import list_groups, check_groups, protected, protected_callback
1
+ """Authentication and authorization for Dash apps on sync and async backends."""
4
2
 
5
- # oidc auth requires authlib, install with `pip install dash-auth[oidc]`
6
- try:
7
- from .oidc_auth import OIDCAuth, get_oauth
8
- except ModuleNotFoundError:
9
- pass
3
+ from ._optional import OIDCAuth, get_oauth
4
+ from .basic_auth import BasicAuth
5
+ from .group_protection import check_groups, list_groups, protected, protected_callback
6
+ from .public_routes import add_public_routes, public_callback
10
7
  from .version import __version__
11
8
 
12
-
13
9
  __all__ = [
10
+ "BasicAuth",
11
+ "OIDCAuth",
12
+ "__version__",
14
13
  "add_public_routes",
15
14
  "check_groups",
16
- "list_groups",
17
15
  "get_oauth",
16
+ "list_groups",
18
17
  "protected",
19
18
  "protected_callback",
20
19
  "public_callback",
21
- "BasicAuth",
22
- "OIDCAuth",
23
- "__version__",
24
20
  ]
@@ -0,0 +1,24 @@
1
+ """Optional re-exports whose dependencies are not always installed.
2
+
3
+ ``OIDCAuth`` and ``get_oauth`` require authlib
4
+ (``pip install dash-auth-async[oidc]``). When it is missing they resolve to
5
+ ``None`` at runtime so importing the package never fails; attempting to use
6
+ ``OIDCAuth`` without authlib then raises a clear error at the call site.
7
+
8
+ This logic lives here, rather than in ``__init__``, so the package's
9
+ ``__init__`` stays a pure re-export facade. Type-checkers see the real symbols
10
+ (authlib assumed present); the runtime ``None`` fallback is invisible to them.
11
+ """
12
+
13
+ from typing import TYPE_CHECKING
14
+
15
+ if TYPE_CHECKING:
16
+ from .oidc_auth import OIDCAuth, get_oauth
17
+ else:
18
+ try:
19
+ from .oidc_auth import OIDCAuth, get_oauth
20
+ except ModuleNotFoundError:
21
+ OIDCAuth = None
22
+ get_oauth = None
23
+
24
+ __all__ = ["OIDCAuth", "get_oauth"]
@@ -1,10 +1,10 @@
1
- from __future__ import absolute_import
1
+ """Framework-agnostic authentication base class for Dash."""
2
+
2
3
  from abc import ABC, abstractmethod
3
- from typing import Optional
4
4
 
5
5
  from dash import Dash
6
- from .backends import Backend, detect_backend, set_active_backend
7
6
 
7
+ from .backends import Backend, detect_backend, set_active_backend
8
8
  from .public_routes import (
9
9
  add_public_routes,
10
10
  get_public_callbacks,
@@ -15,11 +15,13 @@ from .websocket_auth import enable_ws_auth
15
15
 
16
16
 
17
17
  class Auth(ABC):
18
+ """Base class holding the framework-agnostic auth decision logic."""
19
+
18
20
  def __init__(
19
21
  self,
20
22
  app: Dash,
21
- public_routes: Optional[list] = None,
22
- backend: Optional[Backend] = None,
23
+ public_routes: list | None = None,
24
+ backend: Backend | None = None,
23
25
  **obsolete,
24
26
  ):
25
27
  """Auth base class for authentication in Dash.
@@ -27,8 +29,10 @@ class Auth(ABC):
27
29
  :param app: Dash app
28
30
  :param public_routes: list of public routes, routes should follow the
29
31
  Flask route syntax
30
- """
31
32
 
33
+ Raises:
34
+ TypeError: if any deprecated/unexpected keyword argument is passed.
35
+ """
32
36
  # Deprecated arguments
33
37
  if obsolete:
34
38
  raise TypeError(f"Auth got unexpected keyword arguments: {list(obsolete)}")
@@ -43,14 +47,28 @@ class Auth(ABC):
43
47
 
44
48
  @property
45
49
  def request(self):
50
+ """The active backend's request proxy.
51
+
52
+ Returns:
53
+ The framework-specific request object for the current request.
54
+ """
46
55
  return self.backend.request
47
56
 
48
57
  @property
49
58
  def session(self):
59
+ """The active backend's session proxy.
60
+
61
+ Returns:
62
+ The framework-specific session mapping for the current request.
63
+ """
50
64
  return self.backend.session
51
65
 
52
66
  def _callback_path(self) -> str:
53
- """Path of Dash's callback route, including any URL base prefix."""
67
+ """Path of Dash's callback route, including any URL base prefix.
68
+
69
+ Returns:
70
+ The fully-qualified ``_dash-update-component`` path.
71
+ """
54
72
  url_base = get_url_base(self.app)
55
73
  return f"{url_base.rstrip('/')}/_dash-update-component"
56
74
 
@@ -67,14 +85,16 @@ class Auth(ABC):
67
85
  self._authorize,
68
86
  )
69
87
 
70
- def _authorize(self, path: str, body: Optional[dict]):
88
+ def _authorize(self, path: str, body: dict | None):
71
89
  """Decide whether a request may proceed.
72
90
 
73
91
  Pure decision logic shared by all backends: receives the request
74
92
  path and the parsed JSON body (only provided for the Dash callback
75
- route). Returns None to allow the request, or a login response.
76
- """
93
+ route).
77
94
 
95
+ Returns:
96
+ None to allow the request, or a login response to reject it.
97
+ """
78
98
  public_routes = get_public_routes(self.app)
79
99
  public_callbacks = get_public_callbacks(self.app)
80
100
  if path == self._callback_path():
@@ -109,7 +129,7 @@ class Auth(ABC):
109
129
  # Otherwise, ask the user to log in
110
130
  return self.login_request()
111
131
 
112
- def authorize_ws(self, payload: Optional[dict], user: Optional[dict]) -> bool:
132
+ def authorize_ws(self, payload: dict | None, user: dict | None) -> bool:
113
133
  """Decide whether a WebSocket callback_request may run.
114
134
 
115
135
  Mirrors ``_authorize``'s public checks but, because there is no
@@ -120,7 +140,9 @@ class Auth(ABC):
120
140
  :param payload: the callback payload (same shape as the HTTP
121
141
  ``_dash-update-component`` body: ``output``, ``inputs``, ...)
122
142
  :param user: ``session["user"]`` or ``None``
123
- :return: True to allow the callback, False to reject the connection
143
+
144
+ Returns:
145
+ True to allow the callback, False to reject the connection.
124
146
  """
125
147
  payload = payload or {}
126
148
  public_callbacks = get_public_callbacks(self.app)
@@ -143,8 +165,8 @@ class Auth(ABC):
143
165
 
144
166
  @abstractmethod
145
167
  def is_authorized(self):
146
- pass
168
+ """Return whether the current request is authenticated."""
147
169
 
148
170
  @abstractmethod
149
171
  def login_request(self):
150
- pass
172
+ """Return the response that challenges an unauthenticated client."""