apexauthlib 0.1.6__py3-none-any.whl → 0.1.8__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.
- apexauthlib/fastapi/auth.py +15 -0
- apexauthlib/integration/api.py +12 -10
- {apexauthlib-0.1.6.dist-info → apexauthlib-0.1.8.dist-info}/METADATA +1 -1
- {apexauthlib-0.1.6.dist-info → apexauthlib-0.1.8.dist-info}/RECORD +6 -6
- {apexauthlib-0.1.6.dist-info → apexauthlib-0.1.8.dist-info}/LICENSE +0 -0
- {apexauthlib-0.1.6.dist-info → apexauthlib-0.1.8.dist-info}/WHEEL +0 -0
apexauthlib/fastapi/auth.py
CHANGED
|
@@ -83,6 +83,21 @@ def get_user_with_full_metadata(
|
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
def get_user_and_service_users(
|
|
87
|
+
token: TokenDependable,
|
|
88
|
+
auth: AuthApiProviderDependable,
|
|
89
|
+
) -> tuple[ServiceUserInfo[Any], list[ServiceUserInfo[Any]]]:
|
|
90
|
+
try:
|
|
91
|
+
api = auth.for_token(token)
|
|
92
|
+
return api.full_metadata_for(api.user().id), list(api.users_for_service())
|
|
93
|
+
except Exception as e:
|
|
94
|
+
raise HTTPException(
|
|
95
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
96
|
+
detail=str(e),
|
|
97
|
+
headers={"WWW-Authenticate": "Bearer"},
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
86
101
|
@dataclass
|
|
87
102
|
class TokenResponse:
|
|
88
103
|
access_token: str
|
apexauthlib/integration/api.py
CHANGED
|
@@ -96,17 +96,19 @@ class AuthApi(Generic[ItemT]):
|
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
def users_for_service(self) -> Iterable[ServiceUserInfo[ItemT]]:
|
|
99
|
-
result =
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
result = list(
|
|
100
|
+
JsonDict(
|
|
101
|
+
(
|
|
102
|
+
self.http.with_header("Authorization", f"Bearer {self.token}")
|
|
103
|
+
.get()
|
|
104
|
+
.on_endpoint(f"/services/{self.service_name}/users")
|
|
105
|
+
.on_failure(raises=RuntimeError)
|
|
106
|
+
.json()
|
|
107
|
+
)
|
|
108
|
+
)["data"]["users"]
|
|
109
|
+
)
|
|
108
110
|
|
|
109
|
-
for raw_user in result
|
|
111
|
+
for raw_user in result:
|
|
110
112
|
user = dict(raw_user["user"])
|
|
111
113
|
user["hashed_password"] = "unknown"
|
|
112
114
|
|
|
@@ -2,10 +2,10 @@ apexauthlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
apexauthlib/entities/__init__.py,sha256=KghMo6a2QWdPzWlMqdGAKOaVvRmTCOIVhXtIHrX7A_M,149
|
|
3
3
|
apexauthlib/entities/auth.py,sha256=TOs-3eNWodjrI8iFpozsNnn1KQTbPKCllbGzHSPYah8,836
|
|
4
4
|
apexauthlib/fastapi/__init__.py,sha256=G77C3ZIqjsXdh4fiH5FZyF_hyzVtS3waJJGa_TBGMWE,103
|
|
5
|
-
apexauthlib/fastapi/auth.py,sha256=
|
|
5
|
+
apexauthlib/fastapi/auth.py,sha256=hkvG2BougydElkYbEpwsuSgRoLOLANe6DbVSoa-zBRM,3917
|
|
6
6
|
apexauthlib/integration/__init__.py,sha256=f2lGbyoGct4kpZ2CUTExHhtQHs-1YR_xanvrj9Y4GiI,87
|
|
7
|
-
apexauthlib/integration/api.py,sha256=
|
|
8
|
-
apexauthlib-0.1.
|
|
9
|
-
apexauthlib-0.1.
|
|
10
|
-
apexauthlib-0.1.
|
|
11
|
-
apexauthlib-0.1.
|
|
7
|
+
apexauthlib/integration/api.py,sha256=5GfD0K0abUjrK74hGB9dsUhqGkt2SFsg_cS7He4GQnk,4356
|
|
8
|
+
apexauthlib-0.1.8.dist-info/LICENSE,sha256=iai0ILQTDgUXV1cIXl0UzSeOdFpMFK3shn5aqnz_Uro,1065
|
|
9
|
+
apexauthlib-0.1.8.dist-info/METADATA,sha256=8oZ1_Zjfpuk838nqy7gLI5DR2iDf2vVQB7A7pUhqNko,518
|
|
10
|
+
apexauthlib-0.1.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
11
|
+
apexauthlib-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|