aiohttp-msal 0.6.4__tar.gz → 0.6.5__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 (23) hide show
  1. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/PKG-INFO +1 -1
  2. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/__init__.py +1 -1
  3. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/msal_async.py +9 -5
  4. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/PKG-INFO +1 -1
  5. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/setup.cfg +0 -10
  6. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/LICENSE +0 -0
  7. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/README.md +0 -0
  8. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/redis_tools.py +0 -0
  9. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/routes.py +0 -0
  10. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/settings.py +0 -0
  11. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/settings_base.py +0 -0
  12. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal/user_info.py +0 -0
  13. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/SOURCES.txt +0 -0
  14. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/dependency_links.txt +0 -0
  15. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/requires.txt +0 -0
  16. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/top_level.txt +0 -0
  17. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/aiohttp_msal.egg-info/zip-safe +0 -0
  18. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/pyproject.toml +0 -0
  19. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/setup.py +0 -0
  20. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/tests/__init__.py +0 -0
  21. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/tests/test_init.py +0 -0
  22. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/tests/test_msal_async.py +0 -0
  23. {aiohttp_msal-0.6.4 → aiohttp_msal-0.6.5}/tests/test_settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aiohttp_msal
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: Helper Library to use the Microsoft Authentication Library (MSAL) with aiohttp
5
5
  Home-page: https://github.com/kellerza/aiohttp_msal
6
6
  Author: Johann Kellerman
@@ -13,7 +13,7 @@ from .settings import ENV
13
13
 
14
14
  _LOGGER = logging.getLogger(__name__)
15
15
 
16
- VERSION = "0.6.4"
16
+ VERSION = "0.6.5"
17
17
 
18
18
 
19
19
  def msal_session(*args: Callable[[AsyncMSAL], Union[Any, Awaitable[Any]]]) -> Callable:
@@ -23,7 +23,7 @@ HTTP_PATCH = "patch"
23
23
  HTTP_DELETE = "delete"
24
24
  HTTP_ALLOWED = [HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE]
25
25
 
26
- MY_SCOPE = ["User.Read", "User.Read.All"]
26
+ DEFAULT_SCOPES = ["User.Read", "User.Read.All"]
27
27
 
28
28
 
29
29
  def async_wrap(func: Callable) -> Callable:
@@ -148,12 +148,14 @@ class AsyncMSAL:
148
148
  if hasattr(self, "save_token_cache"):
149
149
  self.save_token_cache(self.token_cache)
150
150
 
151
- def build_auth_code_flow(self, redirect_uri: str) -> str:
151
+ def build_auth_code_flow(
152
+ self, redirect_uri: str, scopes: Optional[list[str]] = None
153
+ ) -> str:
152
154
  """First step - Start the flow."""
153
155
  self.session[TOKEN_CACHE] = None # type: ignore
154
156
  self.session[USER_EMAIL] = None # type: ignore
155
157
  self.session[FLOW_CACHE] = res = self.app.initiate_auth_code_flow(
156
- MY_SCOPE,
158
+ scopes or DEFAULT_SCOPES,
157
159
  redirect_uri=redirect_uri,
158
160
  response_mode="form_post"
159
161
  # max_age=1209600,
@@ -183,11 +185,13 @@ class AsyncMSAL:
183
185
  None, self.acquire_token_by_auth_code_flow, auth_response
184
186
  )
185
187
 
186
- def get_token(self) -> Optional[dict[str, Any]]:
188
+ def get_token(self, scopes: Optional[list[str]] = None) -> Optional[dict[str, Any]]:
187
189
  """Acquire a token based on username."""
188
190
  accounts = self.app.get_accounts()
189
191
  if accounts:
190
- result = self.app.acquire_token_silent(scopes=MY_SCOPE, account=accounts[0])
192
+ result = self.app.acquire_token_silent(
193
+ scopes=scopes or DEFAULT_SCOPES, account=accounts[0]
194
+ )
191
195
  self._save_token_cache()
192
196
  return result
193
197
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aiohttp-msal
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: Helper Library to use the Microsoft Authentication Library (MSAL) with aiohttp
5
5
  Home-page: https://github.com/kellerza/aiohttp_msal
6
6
  Author: Johann Kellerman
@@ -44,22 +44,12 @@ tests =
44
44
  pytest-asyncio
45
45
  pytest-env
46
46
 
47
- [isort]
48
- profile = black
49
-
50
- [flake8]
51
- extend-ignore = E203, E501, W503
52
-
53
47
  [mypy]
54
48
  disallow_untyped_defs = True
55
49
 
56
50
  [mypy-msal.*]
57
51
  ignore_missing_imports = True
58
52
 
59
- [pydocstyle]
60
- match_dir = aiohttp_msal
61
- convention = google
62
-
63
53
  [tool:pytest]
64
54
  filterwarnings =
65
55
  ignore:.+@coroutine.+deprecated.+
File without changes
File without changes
File without changes