diracx-client 0.0.1a49__tar.gz → 0.0.2__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.
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/PKG-INFO +1 -1
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/operations/_operations.py +1 -54
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/__init__.py +2 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_models.py +40 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/operations/_operations.py +2 -75
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/auth/aio.py +27 -3
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/auth/common.py +37 -8
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/auth/sync.py +29 -4
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/.gitignore +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/README.md +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/pyproject.toml +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/_diracx_client_importer.pth +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/_client_importer.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_client.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_configuration.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_patch.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_serialization.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_utils/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_utils/serialization.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_utils/utils.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_vendor.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/_client.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/_configuration.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/_patch.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/_vendor.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/operations/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/operations/_patch.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_enums.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_patch.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/operations/__init__.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/operations/_patch.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/py.typed +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/aio.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/models.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/client/aio.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/client/common.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/client/sync.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/jobs/aio.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/jobs/common.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/jobs/sync.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/patches/utils.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/py.typed +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/sync.py +0 -0
- {diracx_client-0.0.1a49 → diracx_client-0.0.2}/tests/test_auth.py +0 -0
|
@@ -35,7 +35,6 @@ from ...operations._operations import (
|
|
|
35
35
|
build_auth_initiate_authorization_flow_request,
|
|
36
36
|
build_auth_initiate_device_flow_request,
|
|
37
37
|
build_auth_revoke_refresh_token_by_jti_request,
|
|
38
|
-
build_auth_revoke_refresh_token_by_refresh_token_request,
|
|
39
38
|
build_auth_userinfo_request,
|
|
40
39
|
build_config_serve_config_request,
|
|
41
40
|
build_jobs_add_heartbeat_request,
|
|
@@ -293,6 +292,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
|
|
|
293
292
|
raise_if_not_implemented(
|
|
294
293
|
self.__class__,
|
|
295
294
|
[
|
|
295
|
+
"revoke_refresh_token_by_refresh_token",
|
|
296
296
|
"get_oidc_token",
|
|
297
297
|
],
|
|
298
298
|
)
|
|
@@ -583,59 +583,6 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
|
|
|
583
583
|
|
|
584
584
|
return deserialized # type: ignore
|
|
585
585
|
|
|
586
|
-
@distributed_trace_async
|
|
587
|
-
async def revoke_refresh_token_by_refresh_token(self, *, refresh_token: str, client_id: str, **kwargs: Any) -> str:
|
|
588
|
-
"""Revoke Refresh Token By Refresh Token.
|
|
589
|
-
|
|
590
|
-
Revoke a refresh token.
|
|
591
|
-
|
|
592
|
-
:keyword refresh_token: Required.
|
|
593
|
-
:paramtype refresh_token: str
|
|
594
|
-
:keyword client_id: Required.
|
|
595
|
-
:paramtype client_id: str
|
|
596
|
-
:return: str
|
|
597
|
-
:rtype: str
|
|
598
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
599
|
-
"""
|
|
600
|
-
error_map: MutableMapping = {
|
|
601
|
-
401: ClientAuthenticationError,
|
|
602
|
-
404: ResourceNotFoundError,
|
|
603
|
-
409: ResourceExistsError,
|
|
604
|
-
304: ResourceNotModifiedError,
|
|
605
|
-
}
|
|
606
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
607
|
-
|
|
608
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
609
|
-
_params = kwargs.pop("params", {}) or {}
|
|
610
|
-
|
|
611
|
-
cls: ClsType[str] = kwargs.pop("cls", None)
|
|
612
|
-
|
|
613
|
-
_request = build_auth_revoke_refresh_token_by_refresh_token_request(
|
|
614
|
-
refresh_token=refresh_token,
|
|
615
|
-
client_id=client_id,
|
|
616
|
-
headers=_headers,
|
|
617
|
-
params=_params,
|
|
618
|
-
)
|
|
619
|
-
_request.url = self._client.format_url(_request.url)
|
|
620
|
-
|
|
621
|
-
_stream = False
|
|
622
|
-
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
|
623
|
-
_request, stream=_stream, **kwargs
|
|
624
|
-
)
|
|
625
|
-
|
|
626
|
-
response = pipeline_response.http_response
|
|
627
|
-
|
|
628
|
-
if response.status_code not in [200]:
|
|
629
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
630
|
-
raise HttpResponseError(response=response)
|
|
631
|
-
|
|
632
|
-
deserialized = self._deserialize("str", pipeline_response.http_response)
|
|
633
|
-
|
|
634
|
-
if cls:
|
|
635
|
-
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
636
|
-
|
|
637
|
-
return deserialized # type: ignore
|
|
638
|
-
|
|
639
586
|
@distributed_trace_async
|
|
640
587
|
async def revoke_refresh_token_by_jti(self, jti: str, **kwargs: Any) -> str:
|
|
641
588
|
"""Revoke Refresh Token By Jti.
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/__init__.py
RENAMED
|
@@ -14,6 +14,7 @@ if TYPE_CHECKING:
|
|
|
14
14
|
from ._models import ( # type: ignore
|
|
15
15
|
BodyAuthGetOidcToken,
|
|
16
16
|
BodyAuthGetOidcTokenGrantType,
|
|
17
|
+
BodyAuthRevokeRefreshTokenByRefreshToken,
|
|
17
18
|
BodyJobsRescheduleJobs,
|
|
18
19
|
BodyJobsUnassignBulkJobsSandboxes,
|
|
19
20
|
GroupInfo,
|
|
@@ -65,6 +66,7 @@ from ._patch import patch_sdk as _patch_sdk
|
|
|
65
66
|
__all__ = [
|
|
66
67
|
"BodyAuthGetOidcToken",
|
|
67
68
|
"BodyAuthGetOidcTokenGrantType",
|
|
69
|
+
"BodyAuthRevokeRefreshTokenByRefreshToken",
|
|
68
70
|
"BodyJobsRescheduleJobs",
|
|
69
71
|
"BodyJobsUnassignBulkJobsSandboxes",
|
|
70
72
|
"GroupInfo",
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_models.py
RENAMED
|
@@ -94,6 +94,46 @@ class BodyAuthGetOidcTokenGrantType(_serialization.Model):
|
|
|
94
94
|
"""OAuth2 Grant type."""
|
|
95
95
|
|
|
96
96
|
|
|
97
|
+
class BodyAuthRevokeRefreshTokenByRefreshToken(_serialization.Model):
|
|
98
|
+
"""Body_auth_revoke_refresh_token_by_refresh_token.
|
|
99
|
+
|
|
100
|
+
All required parameters must be populated in order to send to server.
|
|
101
|
+
|
|
102
|
+
:ivar token: The refresh token to revoke. Required.
|
|
103
|
+
:vartype token: str
|
|
104
|
+
:ivar token_type_hint: Hint for the type of token being revoked.
|
|
105
|
+
:vartype token_type_hint: str
|
|
106
|
+
:ivar client_id: The client ID of the application requesting the revocation.
|
|
107
|
+
:vartype client_id: str
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
_validation = {
|
|
111
|
+
"token": {"required": True},
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_attribute_map = {
|
|
115
|
+
"token": {"key": "token", "type": "str"},
|
|
116
|
+
"token_type_hint": {"key": "token_type_hint", "type": "str"},
|
|
117
|
+
"client_id": {"key": "client_id", "type": "str"},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
def __init__(
|
|
121
|
+
self, *, token: str, token_type_hint: Optional[str] = None, client_id: str = "myDIRACClientID", **kwargs: Any
|
|
122
|
+
) -> None:
|
|
123
|
+
"""
|
|
124
|
+
:keyword token: The refresh token to revoke. Required.
|
|
125
|
+
:paramtype token: str
|
|
126
|
+
:keyword token_type_hint: Hint for the type of token being revoked.
|
|
127
|
+
:paramtype token_type_hint: str
|
|
128
|
+
:keyword client_id: The client ID of the application requesting the revocation.
|
|
129
|
+
:paramtype client_id: str
|
|
130
|
+
"""
|
|
131
|
+
super().__init__(**kwargs)
|
|
132
|
+
self.token = token
|
|
133
|
+
self.token_type_hint = token_type_hint
|
|
134
|
+
self.client_id = client_id
|
|
135
|
+
|
|
136
|
+
|
|
97
137
|
class BodyJobsRescheduleJobs(_serialization.Model):
|
|
98
138
|
"""Body_jobs_reschedule_jobs.
|
|
99
139
|
|
|
@@ -83,7 +83,7 @@ def build_well_known_get_security_txt_request(**kwargs: Any) -> HttpRequest: #
|
|
|
83
83
|
accept = _headers.pop("Accept", "application/json")
|
|
84
84
|
|
|
85
85
|
# Construct URL
|
|
86
|
-
_url = "/.well-known
|
|
86
|
+
_url = "/.well-known/security.txt"
|
|
87
87
|
|
|
88
88
|
# Construct headers
|
|
89
89
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
@@ -175,27 +175,6 @@ def build_auth_get_refresh_tokens_request(**kwargs: Any) -> HttpRequest:
|
|
|
175
175
|
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
|
|
176
176
|
|
|
177
177
|
|
|
178
|
-
def build_auth_revoke_refresh_token_by_refresh_token_request( # pylint: disable=name-too-long
|
|
179
|
-
*, refresh_token: str, client_id: str, **kwargs: Any
|
|
180
|
-
) -> HttpRequest:
|
|
181
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
182
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
183
|
-
|
|
184
|
-
accept = _headers.pop("Accept", "application/json")
|
|
185
|
-
|
|
186
|
-
# Construct URL
|
|
187
|
-
_url = "/api/auth/revoke"
|
|
188
|
-
|
|
189
|
-
# Construct parameters
|
|
190
|
-
_params["refresh_token"] = _SERIALIZER.query("refresh_token", refresh_token, "str")
|
|
191
|
-
_params["client_id"] = _SERIALIZER.query("client_id", client_id, "str")
|
|
192
|
-
|
|
193
|
-
# Construct headers
|
|
194
|
-
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
195
|
-
|
|
196
|
-
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
|
|
197
|
-
|
|
198
|
-
|
|
199
178
|
def build_auth_revoke_refresh_token_by_jti_request( # pylint: disable=name-too-long
|
|
200
179
|
jti: str, **kwargs: Any
|
|
201
180
|
) -> HttpRequest:
|
|
@@ -816,6 +795,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
|
|
|
816
795
|
raise_if_not_implemented(
|
|
817
796
|
self.__class__,
|
|
818
797
|
[
|
|
798
|
+
"revoke_refresh_token_by_refresh_token",
|
|
819
799
|
"get_oidc_token",
|
|
820
800
|
],
|
|
821
801
|
)
|
|
@@ -1104,59 +1084,6 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
|
|
|
1104
1084
|
|
|
1105
1085
|
return deserialized # type: ignore
|
|
1106
1086
|
|
|
1107
|
-
@distributed_trace
|
|
1108
|
-
def revoke_refresh_token_by_refresh_token(self, *, refresh_token: str, client_id: str, **kwargs: Any) -> str:
|
|
1109
|
-
"""Revoke Refresh Token By Refresh Token.
|
|
1110
|
-
|
|
1111
|
-
Revoke a refresh token.
|
|
1112
|
-
|
|
1113
|
-
:keyword refresh_token: Required.
|
|
1114
|
-
:paramtype refresh_token: str
|
|
1115
|
-
:keyword client_id: Required.
|
|
1116
|
-
:paramtype client_id: str
|
|
1117
|
-
:return: str
|
|
1118
|
-
:rtype: str
|
|
1119
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1120
|
-
"""
|
|
1121
|
-
error_map: MutableMapping = {
|
|
1122
|
-
401: ClientAuthenticationError,
|
|
1123
|
-
404: ResourceNotFoundError,
|
|
1124
|
-
409: ResourceExistsError,
|
|
1125
|
-
304: ResourceNotModifiedError,
|
|
1126
|
-
}
|
|
1127
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1128
|
-
|
|
1129
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
1130
|
-
_params = kwargs.pop("params", {}) or {}
|
|
1131
|
-
|
|
1132
|
-
cls: ClsType[str] = kwargs.pop("cls", None)
|
|
1133
|
-
|
|
1134
|
-
_request = build_auth_revoke_refresh_token_by_refresh_token_request(
|
|
1135
|
-
refresh_token=refresh_token,
|
|
1136
|
-
client_id=client_id,
|
|
1137
|
-
headers=_headers,
|
|
1138
|
-
params=_params,
|
|
1139
|
-
)
|
|
1140
|
-
_request.url = self._client.format_url(_request.url)
|
|
1141
|
-
|
|
1142
|
-
_stream = False
|
|
1143
|
-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1144
|
-
_request, stream=_stream, **kwargs
|
|
1145
|
-
)
|
|
1146
|
-
|
|
1147
|
-
response = pipeline_response.http_response
|
|
1148
|
-
|
|
1149
|
-
if response.status_code not in [200]:
|
|
1150
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1151
|
-
raise HttpResponseError(response=response)
|
|
1152
|
-
|
|
1153
|
-
deserialized = self._deserialize("str", pipeline_response.http_response)
|
|
1154
|
-
|
|
1155
|
-
if cls:
|
|
1156
|
-
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1157
|
-
|
|
1158
|
-
return deserialized # type: ignore
|
|
1159
|
-
|
|
1160
1087
|
@distributed_trace
|
|
1161
1088
|
def revoke_refresh_token_by_jti(self, jti: str, **kwargs: Any) -> str:
|
|
1162
1089
|
"""Revoke Refresh Token By Jti.
|
|
@@ -6,6 +6,7 @@ __all__ list in the corresponding file in the patches directory.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
|
+
from ast import Dict
|
|
9
10
|
|
|
10
11
|
__all__ = [
|
|
11
12
|
"AuthOperations",
|
|
@@ -19,7 +20,7 @@ from ..._generated.aio.operations._operations import (
|
|
|
19
20
|
_models,
|
|
20
21
|
AuthOperations as _AuthOperations,
|
|
21
22
|
)
|
|
22
|
-
from .common import
|
|
23
|
+
from .common import handle_revoke_response, prepare_oidc_request, handle_oidc_response, prepare_revoke_request
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class AuthOperations(_AuthOperations):
|
|
@@ -27,7 +28,7 @@ class AuthOperations(_AuthOperations):
|
|
|
27
28
|
async def get_oidc_token(
|
|
28
29
|
self, device_code: str, client_id: str, **kwargs
|
|
29
30
|
) -> TokenResponse | _models.DeviceFlowErrorResponse:
|
|
30
|
-
request =
|
|
31
|
+
request = prepare_oidc_request(
|
|
31
32
|
device_code=device_code,
|
|
32
33
|
client_id=client_id,
|
|
33
34
|
format_url=self._client.format_url,
|
|
@@ -39,7 +40,30 @@ class AuthOperations(_AuthOperations):
|
|
|
39
40
|
)
|
|
40
41
|
)
|
|
41
42
|
|
|
42
|
-
response =
|
|
43
|
+
response = handle_oidc_response(pipeline_response, self._deserialize)
|
|
43
44
|
if isinstance(response, _models.DeviceFlowErrorResponse):
|
|
44
45
|
return response
|
|
45
46
|
return TokenResponse.model_validate(response.as_dict())
|
|
47
|
+
|
|
48
|
+
@distributed_trace_async
|
|
49
|
+
async def revoke_refresh_token_by_refresh_token(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
token: str,
|
|
53
|
+
client_id: str,
|
|
54
|
+
token_type_hint: str = "refresh_token",
|
|
55
|
+
**kwargs,
|
|
56
|
+
) -> str:
|
|
57
|
+
request = prepare_revoke_request(
|
|
58
|
+
token=token,
|
|
59
|
+
client_id=client_id,
|
|
60
|
+
token_type_hint=token_type_hint,
|
|
61
|
+
format_url=self._client.format_url,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
pipeline_response: PipelineResponse = (
|
|
65
|
+
await self._client._pipeline.run( # pylint: disable=protected-access
|
|
66
|
+
request, stream=False, **kwargs
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
return handle_revoke_response(pipeline_response, self._deserialize)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"prepare_oidc_request",
|
|
7
|
+
"handle_oidc_response",
|
|
8
8
|
]
|
|
9
9
|
|
|
10
10
|
from typing import Any
|
|
@@ -18,20 +18,24 @@ from ..._generated.models import TokenResponse, DeviceFlowErrorResponse
|
|
|
18
18
|
from ..._generated.operations._operations import _SERIALIZER
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def build_request(**kwargs: Any) -> HttpRequest:
|
|
22
22
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
23
23
|
|
|
24
24
|
accept = _headers.pop("Accept", "application/json")
|
|
25
25
|
|
|
26
|
-
_url = "
|
|
26
|
+
_url = kwargs.pop("url")
|
|
27
27
|
|
|
28
28
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
_method = kwargs.pop("method")
|
|
31
31
|
|
|
32
|
+
return HttpRequest(method=_method, url=_url, headers=_headers, **kwargs)
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
def prepare_oidc_request(device_code, client_id, format_url) -> HttpRequest:
|
|
36
|
+
request = build_request(
|
|
37
|
+
method="POST",
|
|
38
|
+
url="/api/auth/token",
|
|
35
39
|
data={
|
|
36
40
|
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
|
|
37
41
|
"device_code": device_code,
|
|
@@ -42,7 +46,21 @@ def prepare_request(device_code, client_id, format_url) -> HttpRequest:
|
|
|
42
46
|
return request
|
|
43
47
|
|
|
44
48
|
|
|
45
|
-
def
|
|
49
|
+
def prepare_revoke_request(token, client_id, token_type_hint, format_url) -> HttpRequest:
|
|
50
|
+
request = build_request(
|
|
51
|
+
method="POST",
|
|
52
|
+
url="/api/auth/revoke",
|
|
53
|
+
data={
|
|
54
|
+
"token": token,
|
|
55
|
+
"client_id": client_id,
|
|
56
|
+
"token_type_hint": token_type_hint,
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
request.url = format_url(request.url)
|
|
60
|
+
return request
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def handle_oidc_response(
|
|
46
64
|
pipeline_response: PipelineResponse, deserialize
|
|
47
65
|
) -> TokenResponse | DeviceFlowErrorResponse:
|
|
48
66
|
response = pipeline_response.http_response
|
|
@@ -54,3 +72,14 @@ def handle_response(
|
|
|
54
72
|
else:
|
|
55
73
|
map_error(status_code=response.status_code, response=response, error_map={})
|
|
56
74
|
raise HttpResponseError(response=response)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def handle_revoke_response(
|
|
78
|
+
pipeline_response: PipelineResponse, deserialize
|
|
79
|
+
) -> str:
|
|
80
|
+
response = pipeline_response.http_response
|
|
81
|
+
|
|
82
|
+
if response.status_code != 200:
|
|
83
|
+
map_error(status_code=response.status_code, response=response, error_map={})
|
|
84
|
+
raise HttpResponseError(response=response)
|
|
85
|
+
return deserialize("str", pipeline_response)
|
|
@@ -18,15 +18,15 @@ from ..._generated.operations._operations import (
|
|
|
18
18
|
_models,
|
|
19
19
|
AuthOperations as _AuthOperations,
|
|
20
20
|
)
|
|
21
|
-
from .common import
|
|
21
|
+
from .common import handle_revoke_response, prepare_oidc_request, handle_oidc_response, prepare_revoke_request
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class AuthOperations(_AuthOperations):
|
|
25
25
|
@distributed_trace
|
|
26
|
-
|
|
26
|
+
def get_oidc_token(
|
|
27
27
|
self, device_code: str, client_id: str, **kwargs
|
|
28
28
|
) -> _models.TokenResponse | _models.DeviceFlowErrorResponse:
|
|
29
|
-
request =
|
|
29
|
+
request = prepare_oidc_request(
|
|
30
30
|
device_code=device_code,
|
|
31
31
|
client_id=client_id,
|
|
32
32
|
format_url=self._client.format_url,
|
|
@@ -38,4 +38,29 @@ class AuthOperations(_AuthOperations):
|
|
|
38
38
|
)
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return handle_oidc_response(pipeline_response, self._deserialize)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@distributed_trace
|
|
45
|
+
def revoke_refresh_token_by_refresh_token(
|
|
46
|
+
self,
|
|
47
|
+
*,
|
|
48
|
+
token: str,
|
|
49
|
+
client_id: str,
|
|
50
|
+
token_type_hint: str = "refresh_token",
|
|
51
|
+
**kwargs,
|
|
52
|
+
) -> str:
|
|
53
|
+
request = prepare_revoke_request(
|
|
54
|
+
token=token,
|
|
55
|
+
client_id=client_id,
|
|
56
|
+
token_type_hint=token_type_hint,
|
|
57
|
+
format_url=self._client.format_url,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
pipeline_response: PipelineResponse = (
|
|
61
|
+
self._client._pipeline.run( # pylint: disable=protected-access
|
|
62
|
+
request, stream=False, **kwargs
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return handle_revoke_response(pipeline_response, self._deserialize)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_serialization.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_utils/__init__.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/_utils/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/aio/operations/_patch.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_enums.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/models/_patch.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/operations/__init__.py
RENAMED
|
File without changes
|
{diracx_client-0.0.1a49 → diracx_client-0.0.2}/src/diracx/client/_generated/operations/_patch.py
RENAMED
|
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
|