| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ..core.pagination import AsyncPager, SyncPager |
| 7 |
from ..core.request_options import RequestOptions |
| 8 |
from ..types.create_token_exchange_profile_response_content import CreateTokenExchangeProfileResponseContent |
| 9 |
from ..types.get_token_exchange_profile_response_content import GetTokenExchangeProfileResponseContent |
| 10 |
from ..types.list_token_exchange_profile_response_content import ListTokenExchangeProfileResponseContent |
| 11 |
from ..types.token_exchange_profile_response_content import TokenExchangeProfileResponseContent |
| 12 |
from ..types.token_exchange_profile_type_enum import TokenExchangeProfileTypeEnum |
| 13 |
from .raw_client import AsyncRawTokenExchangeProfilesClient, RawTokenExchangeProfilesClient |
| 14 |
|
| 15 |
|
| 16 |
OMIT = typing.cast(typing.Any, ...) |
| 17 |
|
| 18 |
|
| 19 |
class TokenExchangeProfilesClient: |
| 20 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 21 |
self._raw_client = RawTokenExchangeProfilesClient(client_wrapper=client_wrapper) |
| 22 |
|
| 23 |
@property |
| 24 |
def with_raw_response(self) -> RawTokenExchangeProfilesClient: |
| 25 |
""" |
| 26 |
Retrieves a raw implementation of this client that returns raw responses. |
| 27 |
|
| 28 |
Returns |
| 29 |
------- |
| 30 |
RawTokenExchangeProfilesClient |
| 31 |
""" |
| 32 |
return self._raw_client |
| 33 |
|
| 34 |
def list( |
| 35 |
self, |
| 36 |
*, |
| 37 |
from_: typing.Optional[str] = None, |
| 38 |
take: typing.Optional[int] = 50, |
| 39 |
request_options: typing.Optional[RequestOptions] = None, |
| 40 |
) -> SyncPager[TokenExchangeProfileResponseContent, ListTokenExchangeProfileResponseContent]: |
| 41 |
""" |
| 42 |
Retrieve a list of all Token Exchange Profiles available in your tenant. |
| 43 |
|
| 44 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 45 |
|
| 46 |
This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: |
| 47 |
|
| 48 |
- `from`: Optional id from which to start selection. |
| 49 |
- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. |
| 50 |
|
| 51 |
**Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. |
| 52 |
|
| 53 |
Parameters |
| 54 |
---------- |
| 55 |
from_ : typing.Optional[str] |
| 56 |
Optional Id from which to start selection. |
| 57 |
|
| 58 |
take : typing.Optional[int] |
| 59 |
Number of results per page. Defaults to 50. |
| 60 |
|
| 61 |
request_options : typing.Optional[RequestOptions] |
| 62 |
Request-specific configuration. |
| 63 |
|
| 64 |
Returns |
| 65 |
------- |
| 66 |
SyncPager[TokenExchangeProfileResponseContent, ListTokenExchangeProfileResponseContent] |
| 67 |
Token Exchange Profile successfully retrieved. |
| 68 |
|
| 69 |
Examples |
| 70 |
-------- |
| 71 |
from auth0 import Auth0 |
| 72 |
|
| 73 |
client = Auth0( |
| 74 |
token="YOUR_TOKEN", |
| 75 |
) |
| 76 |
response = client.token_exchange_profiles.list( |
| 77 |
from_="from", |
| 78 |
take=1, |
| 79 |
) |
| 80 |
for item in response: |
| 81 |
yield item |
| 82 |
# alternatively, you can paginate page-by-page |
| 83 |
for page in response.iter_pages(): |
| 84 |
yield page |
| 85 |
""" |
| 86 |
return self._raw_client.list(from_=from_, take=take, request_options=request_options) |
| 87 |
|
| 88 |
def create( |
| 89 |
self, |
| 90 |
*, |
| 91 |
name: str, |
| 92 |
subject_token_type: str, |
| 93 |
action_id: str, |
| 94 |
type: TokenExchangeProfileTypeEnum, |
| 95 |
request_options: typing.Optional[RequestOptions] = None, |
| 96 |
) -> CreateTokenExchangeProfileResponseContent: |
| 97 |
""" |
| 98 |
Create a new Token Exchange Profile within your tenant. |
| 99 |
|
| 100 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 101 |
|
| 102 |
Parameters |
| 103 |
---------- |
| 104 |
name : str |
| 105 |
Friendly name of this profile. |
| 106 |
|
| 107 |
subject_token_type : str |
| 108 |
Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI. |
| 109 |
|
| 110 |
action_id : str |
| 111 |
The ID of the Custom Token Exchange action to execute for this profile, in order to validate the subject_token. The action must use the custom-token-exchange trigger. |
| 112 |
|
| 113 |
type : TokenExchangeProfileTypeEnum |
| 114 |
|
| 115 |
request_options : typing.Optional[RequestOptions] |
| 116 |
Request-specific configuration. |
| 117 |
|
| 118 |
Returns |
| 119 |
------- |
| 120 |
CreateTokenExchangeProfileResponseContent |
| 121 |
Token exchange profile successfully created. |
| 122 |
|
| 123 |
Examples |
| 124 |
-------- |
| 125 |
from auth0 import Auth0 |
| 126 |
|
| 127 |
client = Auth0( |
| 128 |
token="YOUR_TOKEN", |
| 129 |
) |
| 130 |
client.token_exchange_profiles.create( |
| 131 |
name="name", |
| 132 |
subject_token_type="subject_token_type", |
| 133 |
action_id="action_id", |
| 134 |
type="custom_authentication", |
| 135 |
) |
| 136 |
""" |
| 137 |
_response = self._raw_client.create( |
| 138 |
name=name, |
| 139 |
subject_token_type=subject_token_type, |
| 140 |
action_id=action_id, |
| 141 |
type=type, |
| 142 |
request_options=request_options, |
| 143 |
) |
| 144 |
return _response.data |
| 145 |
|
| 146 |
def get( |
| 147 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 148 |
) -> GetTokenExchangeProfileResponseContent: |
| 149 |
""" |
| 150 |
Retrieve details about a single Token Exchange Profile specified by ID. |
| 151 |
|
| 152 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 153 |
|
| 154 |
Parameters |
| 155 |
---------- |
| 156 |
id : str |
| 157 |
ID of the Token Exchange Profile to retrieve. |
| 158 |
|
| 159 |
request_options : typing.Optional[RequestOptions] |
| 160 |
Request-specific configuration. |
| 161 |
|
| 162 |
Returns |
| 163 |
------- |
| 164 |
GetTokenExchangeProfileResponseContent |
| 165 |
Token Exchange Profile successfully retrieved. |
| 166 |
|
| 167 |
Examples |
| 168 |
-------- |
| 169 |
from auth0 import Auth0 |
| 170 |
|
| 171 |
client = Auth0( |
| 172 |
token="YOUR_TOKEN", |
| 173 |
) |
| 174 |
client.token_exchange_profiles.get( |
| 175 |
id="id", |
| 176 |
) |
| 177 |
""" |
| 178 |
_response = self._raw_client.get(id, request_options=request_options) |
| 179 |
return _response.data |
| 180 |
|
| 181 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 182 |
""" |
| 183 |
Delete a Token Exchange Profile within your tenant. |
| 184 |
|
| 185 |
By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 186 |
|
| 187 |
Parameters |
| 188 |
---------- |
| 189 |
id : str |
| 190 |
ID of the Token Exchange Profile to delete. |
| 191 |
|
| 192 |
request_options : typing.Optional[RequestOptions] |
| 193 |
Request-specific configuration. |
| 194 |
|
| 195 |
Returns |
| 196 |
------- |
| 197 |
None |
| 198 |
|
| 199 |
Examples |
| 200 |
-------- |
| 201 |
from auth0 import Auth0 |
| 202 |
|
| 203 |
client = Auth0( |
| 204 |
token="YOUR_TOKEN", |
| 205 |
) |
| 206 |
client.token_exchange_profiles.delete( |
| 207 |
id="id", |
| 208 |
) |
| 209 |
""" |
| 210 |
_response = self._raw_client.delete(id, request_options=request_options) |
| 211 |
return _response.data |
| 212 |
|
| 213 |
def update( |
| 214 |
self, |
| 215 |
id: str, |
| 216 |
*, |
| 217 |
name: typing.Optional[str] = OMIT, |
| 218 |
subject_token_type: typing.Optional[str] = OMIT, |
| 219 |
request_options: typing.Optional[RequestOptions] = None, |
| 220 |
) -> None: |
| 221 |
""" |
| 222 |
Update a Token Exchange Profile within your tenant. |
| 223 |
|
| 224 |
By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 225 |
|
| 226 |
Parameters |
| 227 |
---------- |
| 228 |
id : str |
| 229 |
ID of the Token Exchange Profile to update. |
| 230 |
|
| 231 |
name : typing.Optional[str] |
| 232 |
Friendly name of this profile. |
| 233 |
|
| 234 |
subject_token_type : typing.Optional[str] |
| 235 |
Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI. |
| 236 |
|
| 237 |
request_options : typing.Optional[RequestOptions] |
| 238 |
Request-specific configuration. |
| 239 |
|
| 240 |
Returns |
| 241 |
------- |
| 242 |
None |
| 243 |
|
| 244 |
Examples |
| 245 |
-------- |
| 246 |
from auth0 import Auth0 |
| 247 |
|
| 248 |
client = Auth0( |
| 249 |
token="YOUR_TOKEN", |
| 250 |
) |
| 251 |
client.token_exchange_profiles.update( |
| 252 |
id="id", |
| 253 |
) |
| 254 |
""" |
| 255 |
_response = self._raw_client.update( |
| 256 |
id, name=name, subject_token_type=subject_token_type, request_options=request_options |
| 257 |
) |
| 258 |
return _response.data |
| 259 |
|
| 260 |
|
| 261 |
class AsyncTokenExchangeProfilesClient: |
| 262 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 263 |
self._raw_client = AsyncRawTokenExchangeProfilesClient(client_wrapper=client_wrapper) |
| 264 |
|
| 265 |
@property |
| 266 |
def with_raw_response(self) -> AsyncRawTokenExchangeProfilesClient: |
| 267 |
""" |
| 268 |
Retrieves a raw implementation of this client that returns raw responses. |
| 269 |
|
| 270 |
Returns |
| 271 |
------- |
| 272 |
AsyncRawTokenExchangeProfilesClient |
| 273 |
""" |
| 274 |
return self._raw_client |
| 275 |
|
| 276 |
async def list( |
| 277 |
self, |
| 278 |
*, |
| 279 |
from_: typing.Optional[str] = None, |
| 280 |
take: typing.Optional[int] = 50, |
| 281 |
request_options: typing.Optional[RequestOptions] = None, |
| 282 |
) -> AsyncPager[TokenExchangeProfileResponseContent, ListTokenExchangeProfileResponseContent]: |
| 283 |
""" |
| 284 |
Retrieve a list of all Token Exchange Profiles available in your tenant. |
| 285 |
|
| 286 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 287 |
|
| 288 |
This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: |
| 289 |
|
| 290 |
- `from`: Optional id from which to start selection. |
| 291 |
- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. |
| 292 |
|
| 293 |
**Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. |
| 294 |
|
| 295 |
Parameters |
| 296 |
---------- |
| 297 |
from_ : typing.Optional[str] |
| 298 |
Optional Id from which to start selection. |
| 299 |
|
| 300 |
take : typing.Optional[int] |
| 301 |
Number of results per page. Defaults to 50. |
| 302 |
|
| 303 |
request_options : typing.Optional[RequestOptions] |
| 304 |
Request-specific configuration. |
| 305 |
|
| 306 |
Returns |
| 307 |
------- |
| 308 |
AsyncPager[TokenExchangeProfileResponseContent, ListTokenExchangeProfileResponseContent] |
| 309 |
Token Exchange Profile successfully retrieved. |
| 310 |
|
| 311 |
Examples |
| 312 |
-------- |
| 313 |
import asyncio |
| 314 |
|
| 315 |
from auth0 import AsyncAuth0 |
| 316 |
|
| 317 |
client = AsyncAuth0( |
| 318 |
token="YOUR_TOKEN", |
| 319 |
) |
| 320 |
|
| 321 |
|
| 322 |
async def main() -> None: |
| 323 |
response = await client.token_exchange_profiles.list( |
| 324 |
from_="from", |
| 325 |
take=1, |
| 326 |
) |
| 327 |
async for item in response: |
| 328 |
yield item |
| 329 |
|
| 330 |
# alternatively, you can paginate page-by-page |
| 331 |
async for page in response.iter_pages(): |
| 332 |
yield page |
| 333 |
|
| 334 |
|
| 335 |
asyncio.run(main()) |
| 336 |
""" |
| 337 |
return await self._raw_client.list(from_=from_, take=take, request_options=request_options) |
| 338 |
|
| 339 |
async def create( |
| 340 |
self, |
| 341 |
*, |
| 342 |
name: str, |
| 343 |
subject_token_type: str, |
| 344 |
action_id: str, |
| 345 |
type: TokenExchangeProfileTypeEnum, |
| 346 |
request_options: typing.Optional[RequestOptions] = None, |
| 347 |
) -> CreateTokenExchangeProfileResponseContent: |
| 348 |
""" |
| 349 |
Create a new Token Exchange Profile within your tenant. |
| 350 |
|
| 351 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 352 |
|
| 353 |
Parameters |
| 354 |
---------- |
| 355 |
name : str |
| 356 |
Friendly name of this profile. |
| 357 |
|
| 358 |
subject_token_type : str |
| 359 |
Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI. |
| 360 |
|
| 361 |
action_id : str |
| 362 |
The ID of the Custom Token Exchange action to execute for this profile, in order to validate the subject_token. The action must use the custom-token-exchange trigger. |
| 363 |
|
| 364 |
type : TokenExchangeProfileTypeEnum |
| 365 |
|
| 366 |
request_options : typing.Optional[RequestOptions] |
| 367 |
Request-specific configuration. |
| 368 |
|
| 369 |
Returns |
| 370 |
------- |
| 371 |
CreateTokenExchangeProfileResponseContent |
| 372 |
Token exchange profile successfully created. |
| 373 |
|
| 374 |
Examples |
| 375 |
-------- |
| 376 |
import asyncio |
| 377 |
|
| 378 |
from auth0 import AsyncAuth0 |
| 379 |
|
| 380 |
client = AsyncAuth0( |
| 381 |
token="YOUR_TOKEN", |
| 382 |
) |
| 383 |
|
| 384 |
|
| 385 |
async def main() -> None: |
| 386 |
await client.token_exchange_profiles.create( |
| 387 |
name="name", |
| 388 |
subject_token_type="subject_token_type", |
| 389 |
action_id="action_id", |
| 390 |
type="custom_authentication", |
| 391 |
) |
| 392 |
|
| 393 |
|
| 394 |
asyncio.run(main()) |
| 395 |
""" |
| 396 |
_response = await self._raw_client.create( |
| 397 |
name=name, |
| 398 |
subject_token_type=subject_token_type, |
| 399 |
action_id=action_id, |
| 400 |
type=type, |
| 401 |
request_options=request_options, |
| 402 |
) |
| 403 |
return _response.data |
| 404 |
|
| 405 |
async def get( |
| 406 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 407 |
) -> GetTokenExchangeProfileResponseContent: |
| 408 |
""" |
| 409 |
Retrieve details about a single Token Exchange Profile specified by ID. |
| 410 |
|
| 411 |
By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 412 |
|
| 413 |
Parameters |
| 414 |
---------- |
| 415 |
id : str |
| 416 |
ID of the Token Exchange Profile to retrieve. |
| 417 |
|
| 418 |
request_options : typing.Optional[RequestOptions] |
| 419 |
Request-specific configuration. |
| 420 |
|
| 421 |
Returns |
| 422 |
------- |
| 423 |
GetTokenExchangeProfileResponseContent |
| 424 |
Token Exchange Profile successfully retrieved. |
| 425 |
|
| 426 |
Examples |
| 427 |
-------- |
| 428 |
import asyncio |
| 429 |
|
| 430 |
from auth0 import AsyncAuth0 |
| 431 |
|
| 432 |
client = AsyncAuth0( |
| 433 |
token="YOUR_TOKEN", |
| 434 |
) |
| 435 |
|
| 436 |
|
| 437 |
async def main() -> None: |
| 438 |
await client.token_exchange_profiles.get( |
| 439 |
id="id", |
| 440 |
) |
| 441 |
|
| 442 |
|
| 443 |
asyncio.run(main()) |
| 444 |
""" |
| 445 |
_response = await self._raw_client.get(id, request_options=request_options) |
| 446 |
return _response.data |
| 447 |
|
| 448 |
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 449 |
""" |
| 450 |
Delete a Token Exchange Profile within your tenant. |
| 451 |
|
| 452 |
By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 453 |
|
| 454 |
Parameters |
| 455 |
---------- |
| 456 |
id : str |
| 457 |
ID of the Token Exchange Profile to delete. |
| 458 |
|
| 459 |
request_options : typing.Optional[RequestOptions] |
| 460 |
Request-specific configuration. |
| 461 |
|
| 462 |
Returns |
| 463 |
------- |
| 464 |
None |
| 465 |
|
| 466 |
Examples |
| 467 |
-------- |
| 468 |
import asyncio |
| 469 |
|
| 470 |
from auth0 import AsyncAuth0 |
| 471 |
|
| 472 |
client = AsyncAuth0( |
| 473 |
token="YOUR_TOKEN", |
| 474 |
) |
| 475 |
|
| 476 |
|
| 477 |
async def main() -> None: |
| 478 |
await client.token_exchange_profiles.delete( |
| 479 |
id="id", |
| 480 |
) |
| 481 |
|
| 482 |
|
| 483 |
asyncio.run(main()) |
| 484 |
""" |
| 485 |
_response = await self._raw_client.delete(id, request_options=request_options) |
| 486 |
return _response.data |
| 487 |
|
| 488 |
async def update( |
| 489 |
self, |
| 490 |
id: str, |
| 491 |
*, |
| 492 |
name: typing.Optional[str] = OMIT, |
| 493 |
subject_token_type: typing.Optional[str] = OMIT, |
| 494 |
request_options: typing.Optional[RequestOptions] = None, |
| 495 |
) -> None: |
| 496 |
""" |
| 497 |
Update a Token Exchange Profile within your tenant. |
| 498 |
|
| 499 |
By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. |
| 500 |
|
| 501 |
Parameters |
| 502 |
---------- |
| 503 |
id : str |
| 504 |
ID of the Token Exchange Profile to update. |
| 505 |
|
| 506 |
name : typing.Optional[str] |
| 507 |
Friendly name of this profile. |
| 508 |
|
| 509 |
subject_token_type : typing.Optional[str] |
| 510 |
Subject token type for this profile. When receiving a token exchange request on the Authentication API, the corresponding token exchange profile with a matching subject_token_type will be executed. This must be a URI. |
| 511 |
|
| 512 |
request_options : typing.Optional[RequestOptions] |
| 513 |
Request-specific configuration. |
| 514 |
|
| 515 |
Returns |
| 516 |
------- |
| 517 |
None |
| 518 |
|
| 519 |
Examples |
| 520 |
-------- |
| 521 |
import asyncio |
| 522 |
|
| 523 |
from auth0 import AsyncAuth0 |
| 524 |
|
| 525 |
client = AsyncAuth0( |
| 526 |
token="YOUR_TOKEN", |
| 527 |
) |
| 528 |
|
| 529 |
|
| 530 |
async def main() -> None: |
| 531 |
await client.token_exchange_profiles.update( |
| 532 |
id="id", |
| 533 |
) |
| 534 |
|
| 535 |
|
| 536 |
asyncio.run(main()) |
| 537 |
""" |
| 538 |
_response = await self._raw_client.update( |
| 539 |
id, name=name, subject_token_type=subject_token_type, request_options=request_options |
| 540 |
) |
| 541 |
return _response.data |