oauthenticator 17.2.0__tar.gz → 17.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.
- {oauthenticator-17.2.0/oauthenticator.egg-info → oauthenticator-17.3.0}/PKG-INFO +1 -1
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/_version.py +1 -1
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/oauth2.py +45 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_generic.py +16 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0/oauthenticator.egg-info}/PKG-INFO +1 -1
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/pyproject.toml +1 -1
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/setup.py +1 -1
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/CONTRIBUTING.md +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/LICENSE +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/MANIFEST.in +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/README.md +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/__init__.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/auth0.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/azuread.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/bitbucket.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/cilogon.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/generic.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/github.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/gitlab.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/globus.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/google.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/mediawiki.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/openshift.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/schemas/cilogon-schema.yaml +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/__init__.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/conftest.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/mocks.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_auth0.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_azuread.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_bitbucket.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_cilogon.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_github.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_gitlab.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_globus.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_google.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_mediawiki.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_oauth2.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator/tests/test_openshift.py +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/SOURCES.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/dependency_links.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/entry_points.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/requires.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/top_level.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/requirements.txt +0 -0
- {oauthenticator-17.2.0 → oauthenticator-17.3.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# __version__ should be updated using tbump, based on configuration in
|
|
2
2
|
# pyproject.toml, according to instructions in RELEASE.md.
|
|
3
3
|
#
|
|
4
|
-
__version__ = "17.
|
|
4
|
+
__version__ = "17.3.0"
|
|
5
5
|
|
|
6
6
|
# version_info looks like (1, 2, 3, "dev") if __version__ is 1.2.3.dev
|
|
7
7
|
version_info = tuple(int(p) if p.isdigit() else p for p in __version__.split("."))
|
|
@@ -545,6 +545,32 @@ class OAuthenticator(Authenticator):
|
|
|
545
545
|
|
|
546
546
|
return False
|
|
547
547
|
|
|
548
|
+
refresh_user_hook = Callable(
|
|
549
|
+
config=True,
|
|
550
|
+
default_value=None,
|
|
551
|
+
allow_none=True,
|
|
552
|
+
help="""
|
|
553
|
+
Hook for refreshing user auth info.
|
|
554
|
+
|
|
555
|
+
If given, allows overriding the `refresh_user` behavior.
|
|
556
|
+
Will be called as::
|
|
557
|
+
|
|
558
|
+
refreshed = await refresh_user_hook(authenticator, user, auth_state)
|
|
559
|
+
|
|
560
|
+
`refresh_user_hook` _may_ be async.
|
|
561
|
+
|
|
562
|
+
where `refreshed` can be:
|
|
563
|
+
|
|
564
|
+
- True (no change)
|
|
565
|
+
- False (require new login)
|
|
566
|
+
- auth_model (dict - the new auth model, if anything should be changeed)
|
|
567
|
+
- None (proceed with default refresh_user behavior -
|
|
568
|
+
allows overriding refresh_user behavior for _some_ users)
|
|
569
|
+
|
|
570
|
+
.. versionadded:: 17.3
|
|
571
|
+
""",
|
|
572
|
+
)
|
|
573
|
+
|
|
548
574
|
logout_redirect_url = Unicode(
|
|
549
575
|
config=True,
|
|
550
576
|
help="""
|
|
@@ -1291,6 +1317,18 @@ class OAuthenticator(Authenticator):
|
|
|
1291
1317
|
# call the oauth endpoints
|
|
1292
1318
|
return await self._token_to_auth_model(token_info)
|
|
1293
1319
|
|
|
1320
|
+
async def _call_refresh_user_hook(self, user, auth_state):
|
|
1321
|
+
"""Call the refresh_user hook"""
|
|
1322
|
+
try:
|
|
1323
|
+
refreshed = self.refresh_user_hook(self, user, auth_state)
|
|
1324
|
+
if isawaitable(refreshed):
|
|
1325
|
+
refreshed = await refreshed
|
|
1326
|
+
except Exception as e:
|
|
1327
|
+
# let hook errors raise, nothing in auth should suppress errors
|
|
1328
|
+
self.log.error(f"Error in refresh_user_hook: {e}")
|
|
1329
|
+
raise
|
|
1330
|
+
return refreshed
|
|
1331
|
+
|
|
1294
1332
|
async def refresh_user(self, user, handler=None, **kwargs):
|
|
1295
1333
|
"""
|
|
1296
1334
|
Refresh user authentication
|
|
@@ -1325,7 +1363,14 @@ class OAuthenticator(Authenticator):
|
|
|
1325
1363
|
if not self.enable_auth_state:
|
|
1326
1364
|
# auth state not enabled, can't refresh
|
|
1327
1365
|
return True
|
|
1366
|
+
|
|
1328
1367
|
auth_state = await user.get_auth_state()
|
|
1368
|
+
|
|
1369
|
+
if self.refresh_user_hook is not None:
|
|
1370
|
+
refreshed = await self._call_refresh_user_hook(user, auth_state)
|
|
1371
|
+
if refreshed is not None:
|
|
1372
|
+
return refreshed
|
|
1373
|
+
|
|
1329
1374
|
if not auth_state:
|
|
1330
1375
|
self.log.info(
|
|
1331
1376
|
f"No auth_state found for user {user.name} refresh, need full authentication",
|
|
@@ -547,6 +547,22 @@ async def test_refresh_user(get_authenticator, generic_client, enable_refresh_to
|
|
|
547
547
|
# from here on, enable auth state required for refresh to do anything
|
|
548
548
|
authenticator.enable_auth_state = True
|
|
549
549
|
|
|
550
|
+
# case: custom refresh hook
|
|
551
|
+
async def async_hook(authenticator, user, auth_state):
|
|
552
|
+
return True
|
|
553
|
+
|
|
554
|
+
authenticator.refresh_user_hook = async_hook
|
|
555
|
+
refreshed = await authenticator.refresh_user(user, handler)
|
|
556
|
+
assert refreshed is True
|
|
557
|
+
|
|
558
|
+
def sync_hook(authenticator, user, auth_state):
|
|
559
|
+
return False
|
|
560
|
+
|
|
561
|
+
authenticator.refresh_user_hook = sync_hook
|
|
562
|
+
refreshed = await authenticator.refresh_user(user, handler)
|
|
563
|
+
assert refreshed is False
|
|
564
|
+
authenticator.refresh_user_hook = None
|
|
565
|
+
|
|
550
566
|
# case: no auth state, but auth state enabled needs refresh
|
|
551
567
|
auth_without_state = auth_model.copy()
|
|
552
568
|
auth_without_state["auth_state"] = None
|
|
@@ -27,7 +27,7 @@ class bdist_egg_disabled(bdist_egg):
|
|
|
27
27
|
setup_args = dict(
|
|
28
28
|
name='oauthenticator',
|
|
29
29
|
packages=find_packages(),
|
|
30
|
-
version="17.
|
|
30
|
+
version="17.3.0",
|
|
31
31
|
description="OAuthenticator: Authenticate JupyterHub users with common OAuth providers",
|
|
32
32
|
long_description=open("README.md").read(),
|
|
33
33
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oauthenticator-17.2.0 → oauthenticator-17.3.0}/oauthenticator.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|