fastapi-sso 0.11.0__tar.gz → 0.12.1__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 (21) hide show
  1. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/PKG-INFO +1 -2
  2. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/base.py +14 -0
  3. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/pyproject.toml +10 -3
  4. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/LICENSE.md +0 -0
  5. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/README.md +0 -0
  6. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/__init__.py +0 -0
  7. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/py.typed +0 -0
  8. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/__init__.py +0 -0
  9. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/facebook.py +0 -0
  10. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/fitbit.py +0 -0
  11. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/generic.py +0 -0
  12. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/github.py +0 -0
  13. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/gitlab.py +0 -0
  14. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/google.py +0 -0
  15. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/kakao.py +0 -0
  16. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/line.py +0 -0
  17. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/linkedin.py +0 -0
  18. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/microsoft.py +0 -0
  19. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/naver.py +0 -0
  20. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/notion.py +0 -0
  21. {fastapi_sso-0.11.0 → fastapi_sso-0.12.1}/fastapi_sso/sso/spotify.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi-sso
3
- Version: 0.11.0
3
+ Version: 0.12.1
4
4
  Summary: FastAPI plugin to enable SSO to most common providers (such as Facebook login, Google login and login via Microsoft Office 365 Account)
5
5
  Home-page: https://tomasvotava.github.io/fastapi-sso/
6
6
  License: MIT
@@ -19,7 +19,6 @@ Requires-Dist: fastapi (>=0.80)
19
19
  Requires-Dist: httpx (>=0.23.0)
20
20
  Requires-Dist: oauthlib (>=3.1.0)
21
21
  Requires-Dist: pydantic[email] (>=1.8.0)
22
- Requires-Dist: pylint (>=3.0.3,<4.0.0)
23
22
  Project-URL: Documentation, https://tomasvotava.github.io/fastapi-sso/
24
23
  Project-URL: Repository, https://github.com/tomasvotava/fastapi-sso
25
24
  Description-Content-Type: text/markdown
@@ -94,6 +94,7 @@ class SSOBase:
94
94
  )
95
95
  self.scope = scope or self.scope
96
96
  self._refresh_token: Optional[str] = None
97
+ self._id_token: Optional[str] = None
97
98
  self._state: Optional[str] = None
98
99
 
99
100
  @property
@@ -154,6 +155,16 @@ class SSOBase:
154
155
  """
155
156
  return self._refresh_token or self.oauth_client.refresh_token
156
157
 
158
+ @property
159
+ def id_token(self) -> Optional[str]:
160
+ """
161
+ Retrieves the id token if returned from provider.
162
+
163
+ Returns:
164
+ Optional[str]: The id token if available.
165
+ """
166
+ return self._id_token
167
+
157
168
  async def openid_from_response(self, response: dict, session: Optional[httpx.AsyncClient] = None) -> OpenID:
158
169
  """
159
170
  Converts a response from the provider's user info endpoint to an OpenID object.
@@ -287,6 +298,7 @@ class SSOBase:
287
298
  def __enter__(self) -> "SSOBase":
288
299
  self._oauth_client = None
289
300
  self._refresh_token = None
301
+ self._id_token = None
290
302
  return self
291
303
 
292
304
  def __exit__(
@@ -331,6 +343,7 @@ class SSOBase:
331
343
  if self._oauth_client is not None: # pragma: no cover
332
344
  self._oauth_client = None
333
345
  self._refresh_token = None
346
+ self._id_token = None
334
347
  warnings.warn(
335
348
  (
336
349
  "Reusing the SSO object is not safe and caused a security issue in previous versions."
@@ -370,6 +383,7 @@ class SSOBase:
370
383
  response = await session.post(token_url, headers=headers, content=body, auth=auth)
371
384
  content = response.json()
372
385
  self._refresh_token = content.get("refresh_token")
386
+ self._id_token = content.get("id_token")
373
387
  self.oauth_client.parse_request_body_response(json.dumps(content))
374
388
 
375
389
  uri, headers, _ = self.oauth_client.add_token(await self.userinfo_endpoint)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "fastapi-sso"
3
- version = "0.11.0"
3
+ version = "0.12.1"
4
4
  description = "FastAPI plugin to enable SSO to most common providers (such as Facebook login, Google login and login via Microsoft Office 365 Account)"
5
5
  authors = ["Tomas Votava <info@tomasvotava.eu>"]
6
6
  readme = "README.md"
@@ -8,7 +8,15 @@ license = "MIT"
8
8
  repository = "https://github.com/tomasvotava/fastapi-sso"
9
9
  homepage = "https://tomasvotava.github.io/fastapi-sso/"
10
10
  documentation = "https://tomasvotava.github.io/fastapi-sso/"
11
- keywords = ["fastapi", "sso", "oauth", "google", "facebook", "spotify", "linkedin"]
11
+ keywords = [
12
+ "fastapi",
13
+ "sso",
14
+ "oauth",
15
+ "google",
16
+ "facebook",
17
+ "spotify",
18
+ "linkedin",
19
+ ]
12
20
  include = ["fastapi_sso/py.typed"]
13
21
 
14
22
 
@@ -71,7 +79,6 @@ httpx = ">=0.23.0"
71
79
  oauthlib = ">=3.1.0"
72
80
  pydantic = { extras = ["email"], version = ">=1.8.0" }
73
81
  python = ">=3.8,<4.0"
74
- pylint = "^3.0.3"
75
82
 
76
83
  [build-system]
77
84
  requires = ["poetry-core>=1.0.0"]
File without changes
File without changes