fastapi-sso 0.11.0__py3-none-any.whl → 0.12.1__py3-none-any.whl
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.
- fastapi_sso/sso/base.py +14 -0
- {fastapi_sso-0.11.0.dist-info → fastapi_sso-0.12.1.dist-info}/METADATA +1 -2
- {fastapi_sso-0.11.0.dist-info → fastapi_sso-0.12.1.dist-info}/RECORD +5 -5
- {fastapi_sso-0.11.0.dist-info → fastapi_sso-0.12.1.dist-info}/LICENSE.md +0 -0
- {fastapi_sso-0.11.0.dist-info → fastapi_sso-0.12.1.dist-info}/WHEEL +0 -0
fastapi_sso/sso/base.py
CHANGED
|
@@ -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
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastapi-sso
|
|
3
|
-
Version: 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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
fastapi_sso/__init__.py,sha256=aqYfVqDcq3sk8BuPNbcVnSED6ouoHi-1is9oe_Lgl-M,654
|
|
2
2
|
fastapi_sso/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
fastapi_sso/sso/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
fastapi_sso/sso/base.py,sha256=
|
|
4
|
+
fastapi_sso/sso/base.py,sha256=K2UnC8ay20lFeCn5WUx1z-DYzpqFYqDC8RZjpVdamTI,14607
|
|
5
5
|
fastapi_sso/sso/facebook.py,sha256=F1ox1auZ5PlJW2xccAN0oF8HpvTA5tF6cdPdXar_xF0,1327
|
|
6
6
|
fastapi_sso/sso/fitbit.py,sha256=OcCL1Go5jZ6XAarucORErX7Nuk9g9qFCQPamdcEbcFE,1258
|
|
7
7
|
fastapi_sso/sso/generic.py,sha256=pLVK7WuxiQS8XdblkdC5h6he6BcybTdMCrXvfdJlvA8,2625
|
|
@@ -15,7 +15,7 @@ fastapi_sso/sso/microsoft.py,sha256=tVxHHGlXTuFCwiLh8pcM7I9aP9ncea5U0ZPp-JEB6hU,
|
|
|
15
15
|
fastapi_sso/sso/naver.py,sha256=mwv7ondZHzaUOXleMiBNkKEHnUywctVUjw0wo83l-II,901
|
|
16
16
|
fastapi_sso/sso/notion.py,sha256=3OU70JpE4mle9DXyZrf4sRpwq1raWcOHjFJrRmsI-EM,1302
|
|
17
17
|
fastapi_sso/sso/spotify.py,sha256=GhB-Fg3C4In_kzkEUCiPHi00oa1a2Z-QuhX3MCve8m4,1249
|
|
18
|
-
fastapi_sso-0.
|
|
19
|
-
fastapi_sso-0.
|
|
20
|
-
fastapi_sso-0.
|
|
21
|
-
fastapi_sso-0.
|
|
18
|
+
fastapi_sso-0.12.1.dist-info/LICENSE.md,sha256=5NVQtYs6liDtYdWM4VObWmTTKaK0k9C9txx5pLPJSyQ,1093
|
|
19
|
+
fastapi_sso-0.12.1.dist-info/METADATA,sha256=MVJfKbWsFkIdawyMkCf9rUqVagOqj1HBQx4yCh7wbkg,4549
|
|
20
|
+
fastapi_sso-0.12.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
21
|
+
fastapi_sso-0.12.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|