aiohttp-msal 0.6.8__tar.gz → 0.7.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.
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/PKG-INFO +1 -1
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/__init__.py +21 -1
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/settings.py +1 -1
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/PKG-INFO +1 -1
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/LICENSE +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/README.md +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/msal_async.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/redis_tools.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/routes.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/settings_base.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal/user_info.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/SOURCES.txt +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/dependency_links.txt +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/requires.txt +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/top_level.txt +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/aiohttp_msal.egg-info/zip-safe +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/pyproject.toml +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/setup.cfg +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/setup.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/tests/__init__.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/tests/test_init.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/tests/test_msal_async.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/tests/test_redis_tools.py +0 -0
- {aiohttp_msal-0.6.8 → aiohttp_msal-0.7.0}/tests/test_settings.py +0 -0
|
@@ -14,7 +14,7 @@ from aiohttp_msal.settings import ENV
|
|
|
14
14
|
|
|
15
15
|
_LOGGER = logging.getLogger(__name__)
|
|
16
16
|
|
|
17
|
-
VERSION = "0.
|
|
17
|
+
VERSION = "0.7.0"
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def msal_session(
|
|
@@ -51,6 +51,26 @@ def authenticated(ses: AsyncMSAL) -> bool:
|
|
|
51
51
|
return bool(ses.mail)
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
def auth_or(
|
|
55
|
+
*args: typing.Callable[[AsyncMSAL], bool | typing.Awaitable[bool]]
|
|
56
|
+
) -> typing.Callable[[AsyncMSAL], typing.Awaitable[bool]]:
|
|
57
|
+
"""Ensure either of the methods is valid. An alternative to at_least_one=True.
|
|
58
|
+
|
|
59
|
+
Arguments can include a list of function to perform login tests etc."""
|
|
60
|
+
|
|
61
|
+
async def or_auth(ses: AsyncMSAL) -> bool:
|
|
62
|
+
"""Or."""
|
|
63
|
+
for arg in args:
|
|
64
|
+
if iscoroutinefunction(arg):
|
|
65
|
+
if await arg(ses):
|
|
66
|
+
return True
|
|
67
|
+
elif arg(ses):
|
|
68
|
+
return True
|
|
69
|
+
raise web.HTTPForbidden
|
|
70
|
+
|
|
71
|
+
return or_auth
|
|
72
|
+
|
|
73
|
+
|
|
54
74
|
async def app_init_redis_session(
|
|
55
75
|
app: web.Application, max_age: int = 3600 * 24 * 90
|
|
56
76
|
) -> None:
|
|
@@ -37,7 +37,7 @@ class MSALSettings(SettingsBase):
|
|
|
37
37
|
|
|
38
38
|
REDIS = "redis://redis1:6379"
|
|
39
39
|
"""OPTIONAL: Redis database connection used by app_init_redis_session()."""
|
|
40
|
-
database: Redis
|
|
40
|
+
database: Redis = None # type: ignore
|
|
41
41
|
"""Store the Redis connection when using app_init_redis_session()."""
|
|
42
42
|
|
|
43
43
|
|
|
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
|