Skip to content

Commit 8b35bd8

Browse files
committed
Improve API docs for AuthManager factories
1 parent 79edb1a commit 8b35bd8

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/neo4j/_async/auth_management.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def basic(
164164
) -> AsyncAuthManager:
165165
"""Create an auth manager handling basic auth password rotation.
166166
167+
This factory wraps the provider function in an auth manager
168+
implementation that caches the provides auth info until either the
169+
server notifies the driver that the auth info is expired (by returning
170+
an error that indicates that basic auth has changed).
171+
167172
.. warning::
168173
169174
The provider function **must not** interact with the driver in any
@@ -202,9 +207,8 @@ async def auth_provider():
202207
:returns:
203208
An instance of an implementation of :class:`.AsyncAuthManager` that
204209
returns auth info from the given provider and refreshes it, calling
205-
the provider again, when the auth info expires (either because it's
206-
reached its expiry time or because the server flagged it as
207-
expired).
210+
the provider again, when the auth info expires (because the server
211+
flagged it as expired).
208212
209213
.. versionadded:: 5.12
210214
"""
@@ -226,6 +230,12 @@ def bearer(
226230
) -> AsyncAuthManager:
227231
"""Create an auth manager for potentially expiring bearer auth tokens.
228232
233+
This factory wraps the provider function in an auth manager
234+
implementation that caches the provides auth info until either the
235+
``ExpiringAuth.expires_at`` is exceeded the server notifies the driver
236+
that the auth info is expired (by returning an error that indicates
237+
that the bearer auth token has expired).
238+
229239
.. warning::
230240
231241
The provider function **must not** interact with the driver in any

src/neo4j/_sync/auth_management.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def basic(
164164
) -> AuthManager:
165165
"""Create an auth manager handling basic auth password rotation.
166166
167+
This factory wraps the provider function in an auth manager
168+
implementation that caches the provides auth info until either the
169+
server notifies the driver that the auth info is expired (by returning
170+
an error that indicates that basic auth has changed).
171+
167172
.. warning::
168173
169174
The provider function **must not** interact with the driver in any
@@ -202,9 +207,8 @@ def auth_provider():
202207
:returns:
203208
An instance of an implementation of :class:`.AuthManager` that
204209
returns auth info from the given provider and refreshes it, calling
205-
the provider again, when the auth info expires (either because it's
206-
reached its expiry time or because the server flagged it as
207-
expired).
210+
the provider again, when the auth info expires (because the server
211+
flagged it as expired).
208212
209213
.. versionadded:: 5.12
210214
"""
@@ -226,6 +230,12 @@ def bearer(
226230
) -> AuthManager:
227231
"""Create an auth manager for potentially expiring bearer auth tokens.
228232
233+
This factory wraps the provider function in an auth manager
234+
implementation that caches the provides auth info until either the
235+
``ExpiringAuth.expires_at`` is exceeded the server notifies the driver
236+
that the auth info is expired (by returning an error that indicates
237+
that the bearer auth token has expired).
238+
229239
.. warning::
230240
231241
The provider function **must not** interact with the driver in any

0 commit comments

Comments
 (0)