| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import typing |
| 6 |
|
| 7 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from ..core.pagination import AsyncPager, SyncPager |
| 9 |
from ..core.request_options import RequestOptions |
| 10 |
from ..types.connection_authentication_purpose import ConnectionAuthenticationPurpose |
| 11 |
from ..types.connection_connected_accounts_purpose import ConnectionConnectedAccountsPurpose |
| 12 |
from ..types.connection_for_list import ConnectionForList |
| 13 |
from ..types.connection_identity_provider_enum import ConnectionIdentityProviderEnum |
| 14 |
from ..types.connection_properties_options import ConnectionPropertiesOptions |
| 15 |
from ..types.connection_strategy_enum import ConnectionStrategyEnum |
| 16 |
from ..types.connections_metadata import ConnectionsMetadata |
| 17 |
from ..types.create_connection_response_content import CreateConnectionResponseContent |
| 18 |
from ..types.create_cross_app_access_resource_app import CreateCrossAppAccessResourceApp |
| 19 |
from ..types.cross_app_access_requesting_app import CrossAppAccessRequestingApp |
| 20 |
from ..types.get_connection_response_content import GetConnectionResponseContent |
| 21 |
from ..types.list_connections_checkpoint_paginated_response_content import ( |
| 22 |
ListConnectionsCheckpointPaginatedResponseContent, |
| 23 |
) |
| 24 |
from ..types.update_connection_options import UpdateConnectionOptions |
| 25 |
from ..types.update_connection_response_content import UpdateConnectionResponseContent |
| 26 |
from ..types.update_cross_app_access_resource_app import UpdateCrossAppAccessResourceApp |
| 27 |
from .raw_client import AsyncRawConnectionsClient, RawConnectionsClient |
| 28 |
|
| 29 |
if typing.TYPE_CHECKING: |
| 30 |
from .clients.client import AsyncClientsClient, ClientsClient |
| 31 |
from .directory_provisioning.client import AsyncDirectoryProvisioningClient, DirectoryProvisioningClient |
| 32 |
from .keys.client import AsyncKeysClient, KeysClient |
| 33 |
from .scim_configuration.client import AsyncScimConfigurationClient, ScimConfigurationClient |
| 34 |
from .users.client import AsyncUsersClient, UsersClient |
| 35 |
|
| 36 |
OMIT = typing.cast(typing.Any, ...) |
| 37 |
|
| 38 |
|
| 39 |
class ConnectionsClient: |
| 40 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 41 |
self._raw_client = RawConnectionsClient(client_wrapper=client_wrapper) |
| 42 |
self._client_wrapper = client_wrapper |
| 43 |
self._directory_provisioning: typing.Optional[DirectoryProvisioningClient] = None |
| 44 |
self._scim_configuration: typing.Optional[ScimConfigurationClient] = None |
| 45 |
self._clients: typing.Optional[ClientsClient] = None |
| 46 |
self._keys: typing.Optional[KeysClient] = None |
| 47 |
self._users: typing.Optional[UsersClient] = None |
| 48 |
|
| 49 |
@property |
| 50 |
def with_raw_response(self) -> RawConnectionsClient: |
| 51 |
""" |
| 52 |
Retrieves a raw implementation of this client that returns raw responses. |
| 53 |
|
| 54 |
Returns |
| 55 |
------- |
| 56 |
RawConnectionsClient |
| 57 |
""" |
| 58 |
return self._raw_client |
| 59 |
|
| 60 |
def list( |
| 61 |
self, |
| 62 |
*, |
| 63 |
from_: typing.Optional[str] = None, |
| 64 |
take: typing.Optional[int] = 50, |
| 65 |
strategy: typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] = None, |
| 66 |
name: typing.Optional[str] = None, |
| 67 |
fields: typing.Optional[str] = None, |
| 68 |
include_fields: typing.Optional[bool] = None, |
| 69 |
request_options: typing.Optional[RequestOptions] = None, |
| 70 |
) -> SyncPager[ConnectionForList, ListConnectionsCheckpointPaginatedResponseContent]: |
| 71 |
""" |
| 72 |
Retrieves detailed list of all [connections](https://auth0.com/docs/authenticate/identity-providers) that match the specified strategy. If no strategy is provided, all connections within your tenant are retrieved. This action can accept a list of fields to include or exclude from the resulting list of connections. |
| 73 |
|
| 74 |
This endpoint supports two types of pagination: |
| 75 |
|
| 76 |
- Offset pagination |
| 77 |
- Checkpoint pagination |
| 78 |
|
| 79 |
Checkpoint pagination must be used if you need to retrieve more than 1000 connections. |
| 80 |
|
| 81 |
**Checkpoint Pagination** |
| 82 |
|
| 83 |
To search by checkpoint, use the following parameters: |
| 84 |
|
| 85 |
- `from`: Optional id from which to start selection. |
| 86 |
- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. |
| 87 |
|
| 88 |
**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. |
| 89 |
|
| 90 |
Parameters |
| 91 |
---------- |
| 92 |
from_ : typing.Optional[str] |
| 93 |
Optional Id from which to start selection. |
| 94 |
|
| 95 |
take : typing.Optional[int] |
| 96 |
Number of results per page. Defaults to 50. |
| 97 |
|
| 98 |
strategy : typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] |
| 99 |
Provide strategies to only retrieve connections with such strategies |
| 100 |
|
| 101 |
name : typing.Optional[str] |
| 102 |
Provide the name of the connection to retrieve |
| 103 |
|
| 104 |
fields : typing.Optional[str] |
| 105 |
A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields |
| 106 |
|
| 107 |
include_fields : typing.Optional[bool] |
| 108 |
<code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>) |
| 109 |
|
| 110 |
request_options : typing.Optional[RequestOptions] |
| 111 |
Request-specific configuration. |
| 112 |
|
| 113 |
Returns |
| 114 |
------- |
| 115 |
SyncPager[ConnectionForList, ListConnectionsCheckpointPaginatedResponseContent] |
| 116 |
The connections were retrieved. |
| 117 |
|
| 118 |
Examples |
| 119 |
-------- |
| 120 |
from auth0 import Auth0 |
| 121 |
|
| 122 |
client = Auth0( |
| 123 |
token="YOUR_TOKEN", |
| 124 |
) |
| 125 |
response = client.connections.list( |
| 126 |
from_="from", |
| 127 |
take=1, |
| 128 |
strategy=["ad"], |
| 129 |
name="name", |
| 130 |
fields="fields", |
| 131 |
include_fields=True, |
| 132 |
) |
| 133 |
for item in response: |
| 134 |
yield item |
| 135 |
# alternatively, you can paginate page-by-page |
| 136 |
for page in response.iter_pages(): |
| 137 |
yield page |
| 138 |
""" |
| 139 |
return self._raw_client.list( |
| 140 |
from_=from_, |
| 141 |
take=take, |
| 142 |
strategy=strategy, |
| 143 |
name=name, |
| 144 |
fields=fields, |
| 145 |
include_fields=include_fields, |
| 146 |
request_options=request_options, |
| 147 |
) |
| 148 |
|
| 149 |
def create( |
| 150 |
self, |
| 151 |
*, |
| 152 |
name: str, |
| 153 |
strategy: ConnectionIdentityProviderEnum, |
| 154 |
display_name: typing.Optional[str] = OMIT, |
| 155 |
options: typing.Optional[ConnectionPropertiesOptions] = OMIT, |
| 156 |
enabled_clients: typing.Optional[typing.Sequence[str]] = OMIT, |
| 157 |
is_domain_connection: typing.Optional[bool] = OMIT, |
| 158 |
show_as_button: typing.Optional[bool] = OMIT, |
| 159 |
realms: typing.Optional[typing.Sequence[str]] = OMIT, |
| 160 |
metadata: typing.Optional[ConnectionsMetadata] = OMIT, |
| 161 |
authentication: typing.Optional[ConnectionAuthenticationPurpose] = OMIT, |
| 162 |
connected_accounts: typing.Optional[ConnectionConnectedAccountsPurpose] = OMIT, |
| 163 |
cross_app_access_requesting_app: typing.Optional[CrossAppAccessRequestingApp] = OMIT, |
| 164 |
cross_app_access_resource_app: typing.Optional[CreateCrossAppAccessResourceApp] = OMIT, |
| 165 |
request_options: typing.Optional[RequestOptions] = None, |
| 166 |
) -> CreateConnectionResponseContent: |
| 167 |
""" |
| 168 |
Creates a new connection according to the JSON object received in `body`. |
| 169 |
|
| 170 |
**Note:** If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results. |
| 171 |
|
| 172 |
Parameters |
| 173 |
---------- |
| 174 |
name : str |
| 175 |
The name of the connection. Must start and end with an alphanumeric character and can only contain alphanumeric characters and '-'. Max length 128 |
| 176 |
|
| 177 |
strategy : ConnectionIdentityProviderEnum |
| 178 |
|
| 179 |
display_name : typing.Optional[str] |
| 180 |
Connection name used in the new universal login experience |
| 181 |
|
| 182 |
options : typing.Optional[ConnectionPropertiesOptions] |
| 183 |
|
| 184 |
enabled_clients : typing.Optional[typing.Sequence[str]] |
| 185 |
Use of this property is NOT RECOMMENDED. Use the PATCH /v2/connections/{id}/clients endpoint to enable the connection for a set of clients. |
| 186 |
|
| 187 |
is_domain_connection : typing.Optional[bool] |
| 188 |
<code>true</code> promotes to a domain-level connection so that third-party applications can use it. <code>false</code> does not promote the connection, so only first-party applications with the connection enabled can use it. (Defaults to <code>false</code>.) |
| 189 |
|
| 190 |
show_as_button : typing.Optional[bool] |
| 191 |
Enables showing a button for the connection in the login page (new experience only). If false, it will be usable only by HRD. (Defaults to <code>false</code>.) |
| 192 |
|
| 193 |
realms : typing.Optional[typing.Sequence[str]] |
| 194 |
Defines the realms for which the connection will be used (ie: email domains). If the array is empty or the property is not specified, the connection name will be added as realm. |
| 195 |
|
| 196 |
metadata : typing.Optional[ConnectionsMetadata] |
| 197 |
|
| 198 |
authentication : typing.Optional[ConnectionAuthenticationPurpose] |
| 199 |
|
| 200 |
connected_accounts : typing.Optional[ConnectionConnectedAccountsPurpose] |
| 201 |
|
| 202 |
cross_app_access_requesting_app : typing.Optional[CrossAppAccessRequestingApp] |
| 203 |
|
| 204 |
cross_app_access_resource_app : typing.Optional[CreateCrossAppAccessResourceApp] |
| 205 |
|
| 206 |
request_options : typing.Optional[RequestOptions] |
| 207 |
Request-specific configuration. |
| 208 |
|
| 209 |
Returns |
| 210 |
------- |
| 211 |
CreateConnectionResponseContent |
| 212 |
The connection was created. |
| 213 |
|
| 214 |
Examples |
| 215 |
-------- |
| 216 |
from auth0 import Auth0 |
| 217 |
|
| 218 |
client = Auth0( |
| 219 |
token="YOUR_TOKEN", |
| 220 |
) |
| 221 |
client.connections.create( |
| 222 |
name="name", |
| 223 |
strategy="ad", |
| 224 |
) |
| 225 |
""" |
| 226 |
_response = self._raw_client.create( |
| 227 |
name=name, |
| 228 |
strategy=strategy, |
| 229 |
display_name=display_name, |
| 230 |
options=options, |
| 231 |
enabled_clients=enabled_clients, |
| 232 |
is_domain_connection=is_domain_connection, |
| 233 |
show_as_button=show_as_button, |
| 234 |
realms=realms, |
| 235 |
metadata=metadata, |
| 236 |
authentication=authentication, |
| 237 |
connected_accounts=connected_accounts, |
| 238 |
cross_app_access_requesting_app=cross_app_access_requesting_app, |
| 239 |
cross_app_access_resource_app=cross_app_access_resource_app, |
| 240 |
request_options=request_options, |
| 241 |
) |
| 242 |
return _response.data |
| 243 |
|
| 244 |
def get( |
| 245 |
self, |
| 246 |
id: str, |
| 247 |
*, |
| 248 |
fields: typing.Optional[str] = None, |
| 249 |
include_fields: typing.Optional[bool] = None, |
| 250 |
request_options: typing.Optional[RequestOptions] = None, |
| 251 |
) -> GetConnectionResponseContent: |
| 252 |
""" |
| 253 |
Retrieve details for a specified [connection](https://auth0.com/docs/authenticate/identity-providers) along with options that can be used for identity provider configuration. |
| 254 |
|
| 255 |
Parameters |
| 256 |
---------- |
| 257 |
id : str |
| 258 |
The id of the connection to retrieve |
| 259 |
|
| 260 |
fields : typing.Optional[str] |
| 261 |
A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields |
| 262 |
|
| 263 |
include_fields : typing.Optional[bool] |
| 264 |
<code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>) |
| 265 |
|
| 266 |
request_options : typing.Optional[RequestOptions] |
| 267 |
Request-specific configuration. |
| 268 |
|
| 269 |
Returns |
| 270 |
------- |
| 271 |
GetConnectionResponseContent |
| 272 |
The connection was retrieved. |
| 273 |
|
| 274 |
Examples |
| 275 |
-------- |
| 276 |
from auth0 import Auth0 |
| 277 |
|
| 278 |
client = Auth0( |
| 279 |
token="YOUR_TOKEN", |
| 280 |
) |
| 281 |
client.connections.get( |
| 282 |
id="id", |
| 283 |
fields="fields", |
| 284 |
include_fields=True, |
| 285 |
) |
| 286 |
""" |
| 287 |
_response = self._raw_client.get( |
| 288 |
id, fields=fields, include_fields=include_fields, request_options=request_options |
| 289 |
) |
| 290 |
return _response.data |
| 291 |
|
| 292 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 293 |
""" |
| 294 |
Removes a specific [connection](https://auth0.com/docs/authenticate/identity-providers) from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate. |
| 295 |
|
| 296 |
**Note:** If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent [create connection](https://auth0.com/docs/api/management/v2/connections/post-connections) requests, if they use an identical connection name. |
| 297 |
|
| 298 |
Parameters |
| 299 |
---------- |
| 300 |
id : str |
| 301 |
The id of the connection to delete |
| 302 |
|
| 303 |
request_options : typing.Optional[RequestOptions] |
| 304 |
Request-specific configuration. |
| 305 |
|
| 306 |
Returns |
| 307 |
------- |
| 308 |
None |
| 309 |
|
| 310 |
Examples |
| 311 |
-------- |
| 312 |
from auth0 import Auth0 |
| 313 |
|
| 314 |
client = Auth0( |
| 315 |
token="YOUR_TOKEN", |
| 316 |
) |
| 317 |
client.connections.delete( |
| 318 |
id="id", |
| 319 |
) |
| 320 |
""" |
| 321 |
_response = self._raw_client.delete(id, request_options=request_options) |
| 322 |
return _response.data |
| 323 |
|
| 324 |
def update( |
| 325 |
self, |
| 326 |
id: str, |
| 327 |
*, |
| 328 |
display_name: typing.Optional[str] = OMIT, |
| 329 |
options: typing.Optional[UpdateConnectionOptions] = OMIT, |
| 330 |
enabled_clients: typing.Optional[typing.Sequence[str]] = OMIT, |
| 331 |
is_domain_connection: typing.Optional[bool] = OMIT, |
| 332 |
show_as_button: typing.Optional[bool] = OMIT, |
| 333 |
realms: typing.Optional[typing.Sequence[str]] = OMIT, |
| 334 |
metadata: typing.Optional[ConnectionsMetadata] = OMIT, |
| 335 |
authentication: typing.Optional[ConnectionAuthenticationPurpose] = OMIT, |
| 336 |
connected_accounts: typing.Optional[ConnectionConnectedAccountsPurpose] = OMIT, |
| 337 |
cross_app_access_requesting_app: typing.Optional[CrossAppAccessRequestingApp] = OMIT, |
| 338 |
cross_app_access_resource_app: typing.Optional[UpdateCrossAppAccessResourceApp] = OMIT, |
| 339 |
request_options: typing.Optional[RequestOptions] = None, |
| 340 |
) -> UpdateConnectionResponseContent: |
| 341 |
""" |
| 342 |
Update details for a specific [connection](https://auth0.com/docs/authenticate/identity-providers), including option properties for identity provider configuration. |
| 343 |
|
| 344 |
**Note**: If you use the `options` parameter, the entire `options` object is overridden. To avoid partial data or other issues, ensure all parameters are present when using this option. |
| 345 |
|
| 346 |
Parameters |
| 347 |
---------- |
| 348 |
id : str |
| 349 |
The id of the connection to update |
| 350 |
|
| 351 |
display_name : typing.Optional[str] |
| 352 |
The connection name used in the new universal login experience. If display_name is not included in the request, the field will be overwritten with the name value. |
| 353 |
|
| 354 |
options : typing.Optional[UpdateConnectionOptions] |
| 355 |
|
| 356 |
enabled_clients : typing.Optional[typing.Sequence[str]] |
| 357 |
DEPRECATED property. Use the PATCH /v2/connections/{id}/clients endpoint to enable or disable the connection for any clients. |
| 358 |
|
| 359 |
is_domain_connection : typing.Optional[bool] |
| 360 |
<code>true</code> promotes to a domain-level connection so that third-party applications can use it. <code>false</code> does not promote the connection, so only first-party applications with the connection enabled can use it. (Defaults to <code>false</code>.) |
| 361 |
|
| 362 |
show_as_button : typing.Optional[bool] |
| 363 |
Enables showing a button for the connection in the login page (new experience only). If false, it will be usable only by HRD. (Defaults to <code>false</code>.) |
| 364 |
|
| 365 |
realms : typing.Optional[typing.Sequence[str]] |
| 366 |
Defines the realms for which the connection will be used (ie: email domains). If the array is empty or the property is not specified, the connection name will be added as realm. |
| 367 |
|
| 368 |
metadata : typing.Optional[ConnectionsMetadata] |
| 369 |
|
| 370 |
authentication : typing.Optional[ConnectionAuthenticationPurpose] |
| 371 |
|
| 372 |
connected_accounts : typing.Optional[ConnectionConnectedAccountsPurpose] |
| 373 |
|
| 374 |
cross_app_access_requesting_app : typing.Optional[CrossAppAccessRequestingApp] |
| 375 |
|
| 376 |
cross_app_access_resource_app : typing.Optional[UpdateCrossAppAccessResourceApp] |
| 377 |
|
| 378 |
request_options : typing.Optional[RequestOptions] |
| 379 |
Request-specific configuration. |
| 380 |
|
| 381 |
Returns |
| 382 |
------- |
| 383 |
UpdateConnectionResponseContent |
| 384 |
The connection was updated. |
| 385 |
|
| 386 |
Examples |
| 387 |
-------- |
| 388 |
from auth0 import Auth0 |
| 389 |
|
| 390 |
client = Auth0( |
| 391 |
token="YOUR_TOKEN", |
| 392 |
) |
| 393 |
client.connections.update( |
| 394 |
id="id", |
| 395 |
) |
| 396 |
""" |
| 397 |
_response = self._raw_client.update( |
| 398 |
id, |
| 399 |
display_name=display_name, |
| 400 |
options=options, |
| 401 |
enabled_clients=enabled_clients, |
| 402 |
is_domain_connection=is_domain_connection, |
| 403 |
show_as_button=show_as_button, |
| 404 |
realms=realms, |
| 405 |
metadata=metadata, |
| 406 |
authentication=authentication, |
| 407 |
connected_accounts=connected_accounts, |
| 408 |
cross_app_access_requesting_app=cross_app_access_requesting_app, |
| 409 |
cross_app_access_resource_app=cross_app_access_resource_app, |
| 410 |
request_options=request_options, |
| 411 |
) |
| 412 |
return _response.data |
| 413 |
|
| 414 |
def check_status(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 415 |
""" |
| 416 |
Retrieves the status of an ad/ldap connection referenced by its `ID`. `200 OK` http status code response is returned when the connection is online, otherwise a `404` status code is returned along with an error message |
| 417 |
|
| 418 |
Parameters |
| 419 |
---------- |
| 420 |
id : str |
| 421 |
ID of the connection to check |
| 422 |
|
| 423 |
request_options : typing.Optional[RequestOptions] |
| 424 |
Request-specific configuration. |
| 425 |
|
| 426 |
Returns |
| 427 |
------- |
| 428 |
None |
| 429 |
|
| 430 |
Examples |
| 431 |
-------- |
| 432 |
from auth0 import Auth0 |
| 433 |
|
| 434 |
client = Auth0( |
| 435 |
token="YOUR_TOKEN", |
| 436 |
) |
| 437 |
client.connections.check_status( |
| 438 |
id="id", |
| 439 |
) |
| 440 |
""" |
| 441 |
_response = self._raw_client.check_status(id, request_options=request_options) |
| 442 |
return _response.data |
| 443 |
|
| 444 |
@property |
| 445 |
def directory_provisioning(self): |
| 446 |
if self._directory_provisioning is None: |
| 447 |
from .directory_provisioning.client import DirectoryProvisioningClient |
| 448 |
|
| 449 |
self._directory_provisioning = DirectoryProvisioningClient(client_wrapper=self._client_wrapper) |
| 450 |
return self._directory_provisioning |
| 451 |
|
| 452 |
@property |
| 453 |
def scim_configuration(self): |
| 454 |
if self._scim_configuration is None: |
| 455 |
from .scim_configuration.client import ScimConfigurationClient |
| 456 |
|
| 457 |
self._scim_configuration = ScimConfigurationClient(client_wrapper=self._client_wrapper) |
| 458 |
return self._scim_configuration |
| 459 |
|
| 460 |
@property |
| 461 |
def clients(self): |
| 462 |
if self._clients is None: |
| 463 |
from .clients.client import ClientsClient |
| 464 |
|
| 465 |
self._clients = ClientsClient(client_wrapper=self._client_wrapper) |
| 466 |
return self._clients |
| 467 |
|
| 468 |
@property |
| 469 |
def keys(self): |
| 470 |
if self._keys is None: |
| 471 |
from .keys.client import KeysClient |
| 472 |
|
| 473 |
self._keys = KeysClient(client_wrapper=self._client_wrapper) |
| 474 |
return self._keys |
| 475 |
|
| 476 |
@property |
| 477 |
def users(self): |
| 478 |
if self._users is None: |
| 479 |
from .users.client import UsersClient |
| 480 |
|
| 481 |
self._users = UsersClient(client_wrapper=self._client_wrapper) |
| 482 |
return self._users |
| 483 |
|
| 484 |
|
| 485 |
class AsyncConnectionsClient: |
| 486 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 487 |
self._raw_client = AsyncRawConnectionsClient(client_wrapper=client_wrapper) |
| 488 |
self._client_wrapper = client_wrapper |
| 489 |
self._directory_provisioning: typing.Optional[AsyncDirectoryProvisioningClient] = None |
| 490 |
self._scim_configuration: typing.Optional[AsyncScimConfigurationClient] = None |
| 491 |
self._clients: typing.Optional[AsyncClientsClient] = None |
| 492 |
self._keys: typing.Optional[AsyncKeysClient] = None |
| 493 |
self._users: typing.Optional[AsyncUsersClient] = None |
| 494 |
|
| 495 |
@property |
| 496 |
def with_raw_response(self) -> AsyncRawConnectionsClient: |
| 497 |
""" |
| 498 |
Retrieves a raw implementation of this client that returns raw responses. |
| 499 |
|
| 500 |
Returns |
| 501 |
------- |
| 502 |
AsyncRawConnectionsClient |
| 503 |
""" |
| 504 |
return self._raw_client |
| 505 |
|
| 506 |
async def list( |
| 507 |
self, |
| 508 |
*, |
| 509 |
from_: typing.Optional[str] = None, |
| 510 |
take: typing.Optional[int] = 50, |
| 511 |
strategy: typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] = None, |
| 512 |
name: typing.Optional[str] = None, |
| 513 |
fields: typing.Optional[str] = None, |
| 514 |
include_fields: typing.Optional[bool] = None, |
| 515 |
request_options: typing.Optional[RequestOptions] = None, |
| 516 |
) -> AsyncPager[ConnectionForList, ListConnectionsCheckpointPaginatedResponseContent]: |
| 517 |
""" |
| 518 |
Retrieves detailed list of all [connections](https://auth0.com/docs/authenticate/identity-providers) that match the specified strategy. If no strategy is provided, all connections within your tenant are retrieved. This action can accept a list of fields to include or exclude from the resulting list of connections. |
| 519 |
|
| 520 |
This endpoint supports two types of pagination: |
| 521 |
|
| 522 |
- Offset pagination |
| 523 |
- Checkpoint pagination |
| 524 |
|
| 525 |
Checkpoint pagination must be used if you need to retrieve more than 1000 connections. |
| 526 |
|
| 527 |
**Checkpoint Pagination** |
| 528 |
|
| 529 |
To search by checkpoint, use the following parameters: |
| 530 |
|
| 531 |
- `from`: Optional id from which to start selection. |
| 532 |
- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. |
| 533 |
|
| 534 |
**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. |
| 535 |
|
| 536 |
Parameters |
| 537 |
---------- |
| 538 |
from_ : typing.Optional[str] |
| 539 |
Optional Id from which to start selection. |
| 540 |
|
| 541 |
take : typing.Optional[int] |
| 542 |
Number of results per page. Defaults to 50. |
| 543 |
|
| 544 |
strategy : typing.Optional[typing.Union[ConnectionStrategyEnum, typing.Sequence[ConnectionStrategyEnum]]] |
| 545 |
Provide strategies to only retrieve connections with such strategies |
| 546 |
|
| 547 |
name : typing.Optional[str] |
| 548 |
Provide the name of the connection to retrieve |
| 549 |
|
| 550 |
fields : typing.Optional[str] |
| 551 |
A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields |
| 552 |
|
| 553 |
include_fields : typing.Optional[bool] |
| 554 |
<code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>) |
| 555 |
|
| 556 |
request_options : typing.Optional[RequestOptions] |
| 557 |
Request-specific configuration. |
| 558 |
|
| 559 |
Returns |
| 560 |
------- |
| 561 |
AsyncPager[ConnectionForList, ListConnectionsCheckpointPaginatedResponseContent] |
| 562 |
The connections were retrieved. |
| 563 |
|
| 564 |
Examples |
| 565 |
-------- |
| 566 |
import asyncio |
| 567 |
|
| 568 |
from auth0 import AsyncAuth0 |
| 569 |
|
| 570 |
client = AsyncAuth0( |
| 571 |
token="YOUR_TOKEN", |
| 572 |
) |
| 573 |
|
| 574 |
|
| 575 |
async def main() -> None: |
| 576 |
response = await client.connections.list( |
| 577 |
from_="from", |
| 578 |
take=1, |
| 579 |
strategy=["ad"], |
| 580 |
name="name", |
| 581 |
fields="fields", |
| 582 |
include_fields=True, |
| 583 |
) |
| 584 |
async for item in response: |
| 585 |
yield item |
| 586 |
|
| 587 |
# alternatively, you can paginate page-by-page |
| 588 |
async for page in response.iter_pages(): |
| 589 |
yield page |
| 590 |
|
| 591 |
|
| 592 |
asyncio.run(main()) |
| 593 |
""" |
| 594 |
return await self._raw_client.list( |
| 595 |
from_=from_, |
| 596 |
take=take, |
| 597 |
strategy=strategy, |
| 598 |
name=name, |
| 599 |
fields=fields, |
| 600 |
include_fields=include_fields, |
| 601 |
request_options=request_options, |
| 602 |
) |
| 603 |
|
| 604 |
async def create( |
| 605 |
self, |
| 606 |
*, |
| 607 |
name: str, |
| 608 |
strategy: ConnectionIdentityProviderEnum, |
| 609 |
display_name: typing.Optional[str] = OMIT, |
| 610 |
options: typing.Optional[ConnectionPropertiesOptions] = OMIT, |
| 611 |
enabled_clients: typing.Optional[typing.Sequence[str]] = OMIT, |
| 612 |
is_domain_connection: typing.Optional[bool] = OMIT, |
| 613 |
show_as_button: typing.Optional[bool] = OMIT, |
| 614 |
realms: typing.Optional[typing.Sequence[str]] = OMIT, |
| 615 |
metadata: typing.Optional[ConnectionsMetadata] = OMIT, |
| 616 |
authentication: typing.Optional[ConnectionAuthenticationPurpose] = OMIT, |
| 617 |
connected_accounts: typing.Optional[ConnectionConnectedAccountsPurpose] = OMIT, |
| 618 |
cross_app_access_requesting_app: typing.Optional[CrossAppAccessRequestingApp] = OMIT, |
| 619 |
cross_app_access_resource_app: typing.Optional[CreateCrossAppAccessResourceApp] = OMIT, |
| 620 |
request_options: typing.Optional[RequestOptions] = None, |
| 621 |
) -> CreateConnectionResponseContent: |
| 622 |
""" |
| 623 |
Creates a new connection according to the JSON object received in `body`. |
| 624 |
|
| 625 |
**Note:** If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results. |
| 626 |
|
| 627 |
Parameters |
| 628 |
---------- |
| 629 |
name : str |
| 630 |
The name of the connection. Must start and end with an alphanumeric character and can only contain alphanumeric characters and '-'. Max length 128 |
| 631 |
|
| 632 |
strategy : ConnectionIdentityProviderEnum |
| 633 |
|
| 634 |
display_name : typing.Optional[str] |
| 635 |
Connection name used in the new universal login experience |
| 636 |
|
| 637 |
options : typing.Optional[ConnectionPropertiesOptions] |
| 638 |
|
| 639 |
enabled_clients : typing.Optional[typing.Sequence[str]] |
| 640 |
Use of this property is NOT RECOMMENDED. Use the PATCH /v2/connections/{id}/clients endpoint to enable the connection for a set of clients. |
| 641 |
|
| 642 |
is_domain_connection : typing.Optional[bool] |
| 643 |
<code>true</code> promotes to a domain-level connection so that third-party applications can use it. <code>false</code> does not promote the connection, so only first-party applications with the connection enabled can use it. (Defaults to <code>false</code>.) |
| 644 |
|
| 645 |
show_as_button : typing.Optional[bool] |
| 646 |
Enables showing a button for the connection in the login page (new experience only). If false, it will be usable only by HRD. (Defaults to <code>false</code>.) |
| 647 |
|
| 648 |
realms : typing.Optional[typing.Sequence[str]] |
| 649 |
Defines the realms for which the connection will be used (ie: email domains). If the array is empty or the property is not specified, the connection name will be added as realm. |
| 650 |
|
| 651 |
metadata : typing.Optional[ConnectionsMetadata] |
| 652 |
|
| 653 |
authentication : typing.Optional[ConnectionAuthenticationPurpose] |
| 654 |
|
| 655 |
connected_accounts : typing.Optional[ConnectionConnectedAccountsPurpose] |
| 656 |
|
| 657 |
cross_app_access_requesting_app : typing.Optional[CrossAppAccessRequestingApp] |
| 658 |
|
| 659 |
cross_app_access_resource_app : typing.Optional[CreateCrossAppAccessResourceApp] |
| 660 |
|
| 661 |
request_options : typing.Optional[RequestOptions] |
| 662 |
Request-specific configuration. |
| 663 |
|
| 664 |
Returns |
| 665 |
------- |
| 666 |
CreateConnectionResponseContent |
| 667 |
The connection was created. |
| 668 |
|
| 669 |
Examples |
| 670 |
-------- |
| 671 |
import asyncio |
| 672 |
|
| 673 |
from auth0 import AsyncAuth0 |
| 674 |
|
| 675 |
client = AsyncAuth0( |
| 676 |
token="YOUR_TOKEN", |
| 677 |
) |
| 678 |
|
| 679 |
|
| 680 |
async def main() -> None: |
| 681 |
await client.connections.create( |
| 682 |
name="name", |
| 683 |
strategy="ad", |
| 684 |
) |
| 685 |
|
| 686 |
|
| 687 |
asyncio.run(main()) |
| 688 |
""" |
| 689 |
_response = await self._raw_client.create( |
| 690 |
name=name, |
| 691 |
strategy=strategy, |
| 692 |
display_name=display_name, |
| 693 |
options=options, |
| 694 |
enabled_clients=enabled_clients, |
| 695 |
is_domain_connection=is_domain_connection, |
| 696 |
show_as_button=show_as_button, |
| 697 |
realms=realms, |
| 698 |
metadata=metadata, |
| 699 |
authentication=authentication, |
| 700 |
connected_accounts=connected_accounts, |
| 701 |
cross_app_access_requesting_app=cross_app_access_requesting_app, |
| 702 |
cross_app_access_resource_app=cross_app_access_resource_app, |
| 703 |
request_options=request_options, |
| 704 |
) |
| 705 |
return _response.data |
| 706 |
|
| 707 |
async def get( |
| 708 |
self, |
| 709 |
id: str, |
| 710 |
*, |
| 711 |
fields: typing.Optional[str] = None, |
| 712 |
include_fields: typing.Optional[bool] = None, |
| 713 |
request_options: typing.Optional[RequestOptions] = None, |
| 714 |
) -> GetConnectionResponseContent: |
| 715 |
""" |
| 716 |
Retrieve details for a specified [connection](https://auth0.com/docs/authenticate/identity-providers) along with options that can be used for identity provider configuration. |
| 717 |
|
| 718 |
Parameters |
| 719 |
---------- |
| 720 |
id : str |
| 721 |
The id of the connection to retrieve |
| 722 |
|
| 723 |
fields : typing.Optional[str] |
| 724 |
A comma separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields |
| 725 |
|
| 726 |
include_fields : typing.Optional[bool] |
| 727 |
<code>true</code> if the fields specified are to be included in the result, <code>false</code> otherwise (defaults to <code>true</code>) |
| 728 |
|
| 729 |
request_options : typing.Optional[RequestOptions] |
| 730 |
Request-specific configuration. |
| 731 |
|
| 732 |
Returns |
| 733 |
------- |
| 734 |
GetConnectionResponseContent |
| 735 |
The connection was retrieved. |
| 736 |
|
| 737 |
Examples |
| 738 |
-------- |
| 739 |
import asyncio |
| 740 |
|
| 741 |
from auth0 import AsyncAuth0 |
| 742 |
|
| 743 |
client = AsyncAuth0( |
| 744 |
token="YOUR_TOKEN", |
| 745 |
) |
| 746 |
|
| 747 |
|
| 748 |
async def main() -> None: |
| 749 |
await client.connections.get( |
| 750 |
id="id", |
| 751 |
fields="fields", |
| 752 |
include_fields=True, |
| 753 |
) |
| 754 |
|
| 755 |
|
| 756 |
asyncio.run(main()) |
| 757 |
""" |
| 758 |
_response = await self._raw_client.get( |
| 759 |
id, fields=fields, include_fields=include_fields, request_options=request_options |
| 760 |
) |
| 761 |
return _response.data |
| 762 |
|
| 763 |
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 764 |
""" |
| 765 |
Removes a specific [connection](https://auth0.com/docs/authenticate/identity-providers) from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate. |
| 766 |
|
| 767 |
**Note:** If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent [create connection](https://auth0.com/docs/api/management/v2/connections/post-connections) requests, if they use an identical connection name. |
| 768 |
|
| 769 |
Parameters |
| 770 |
---------- |
| 771 |
id : str |
| 772 |
The id of the connection to delete |
| 773 |
|
| 774 |
request_options : typing.Optional[RequestOptions] |
| 775 |
Request-specific configuration. |
| 776 |
|
| 777 |
Returns |
| 778 |
------- |
| 779 |
None |
| 780 |
|
| 781 |
Examples |
| 782 |
-------- |
| 783 |
import asyncio |
| 784 |
|
| 785 |
from auth0 import AsyncAuth0 |
| 786 |
|
| 787 |
client = AsyncAuth0( |
| 788 |
token="YOUR_TOKEN", |
| 789 |
) |
| 790 |
|
| 791 |
|
| 792 |
async def main() -> None: |
| 793 |
await client.connections.delete( |
| 794 |
id="id", |
| 795 |
) |
| 796 |
|
| 797 |
|
| 798 |
asyncio.run(main()) |
| 799 |
""" |
| 800 |
_response = await self._raw_client.delete(id, request_options=request_options) |
| 801 |
return _response.data |
| 802 |
|
| 803 |
async def update( |
| 804 |
self, |
| 805 |
id: str, |
| 806 |
*, |
| 807 |
display_name: typing.Optional[str] = OMIT, |
| 808 |
options: typing.Optional[UpdateConnectionOptions] = OMIT, |
| 809 |
enabled_clients: typing.Optional[typing.Sequence[str]] = OMIT, |
| 810 |
is_domain_connection: typing.Optional[bool] = OMIT, |
| 811 |
show_as_button: typing.Optional[bool] = OMIT, |
| 812 |
realms: typing.Optional[typing.Sequence[str]] = OMIT, |
| 813 |
metadata: typing.Optional[ConnectionsMetadata] = OMIT, |
| 814 |
authentication: typing.Optional[ConnectionAuthenticationPurpose] = OMIT, |
| 815 |
connected_accounts: typing.Optional[ConnectionConnectedAccountsPurpose] = OMIT, |
| 816 |
cross_app_access_requesting_app: typing.Optional[CrossAppAccessRequestingApp] = OMIT, |
| 817 |
cross_app_access_resource_app: typing.Optional[UpdateCrossAppAccessResourceApp] = OMIT, |
| 818 |
request_options: typing.Optional[RequestOptions] = None, |
| 819 |
) -> UpdateConnectionResponseContent: |
| 820 |
""" |
| 821 |
Update details for a specific [connection](https://auth0.com/docs/authenticate/identity-providers), including option properties for identity provider configuration. |
| 822 |
|
| 823 |
**Note**: If you use the `options` parameter, the entire `options` object is overridden. To avoid partial data or other issues, ensure all parameters are present when using this option. |
| 824 |
|
| 825 |
Parameters |
| 826 |
---------- |
| 827 |
id : str |
| 828 |
The id of the connection to update |
| 829 |
|
| 830 |
display_name : typing.Optional[str] |
| 831 |
The connection name used in the new universal login experience. If display_name is not included in the request, the field will be overwritten with the name value. |
| 832 |
|
| 833 |
options : typing.Optional[UpdateConnectionOptions] |
| 834 |
|
| 835 |
enabled_clients : typing.Optional[typing.Sequence[str]] |
| 836 |
DEPRECATED property. Use the PATCH /v2/connections/{id}/clients endpoint to enable or disable the connection for any clients. |
| 837 |
|
| 838 |
is_domain_connection : typing.Optional[bool] |
| 839 |
<code>true</code> promotes to a domain-level connection so that third-party applications can use it. <code>false</code> does not promote the connection, so only first-party applications with the connection enabled can use it. (Defaults to <code>false</code>.) |
| 840 |
|
| 841 |
show_as_button : typing.Optional[bool] |
| 842 |
Enables showing a button for the connection in the login page (new experience only). If false, it will be usable only by HRD. (Defaults to <code>false</code>.) |
| 843 |
|
| 844 |
realms : typing.Optional[typing.Sequence[str]] |
| 845 |
Defines the realms for which the connection will be used (ie: email domains). If the array is empty or the property is not specified, the connection name will be added as realm. |
| 846 |
|
| 847 |
metadata : typing.Optional[ConnectionsMetadata] |
| 848 |
|
| 849 |
authentication : typing.Optional[ConnectionAuthenticationPurpose] |
| 850 |
|
| 851 |
connected_accounts : typing.Optional[ConnectionConnectedAccountsPurpose] |
| 852 |
|
| 853 |
cross_app_access_requesting_app : typing.Optional[CrossAppAccessRequestingApp] |
| 854 |
|
| 855 |
cross_app_access_resource_app : typing.Optional[UpdateCrossAppAccessResourceApp] |
| 856 |
|
| 857 |
request_options : typing.Optional[RequestOptions] |
| 858 |
Request-specific configuration. |
| 859 |
|
| 860 |
Returns |
| 861 |
------- |
| 862 |
UpdateConnectionResponseContent |
| 863 |
The connection was updated. |
| 864 |
|
| 865 |
Examples |
| 866 |
-------- |
| 867 |
import asyncio |
| 868 |
|
| 869 |
from auth0 import AsyncAuth0 |
| 870 |
|
| 871 |
client = AsyncAuth0( |
| 872 |
token="YOUR_TOKEN", |
| 873 |
) |
| 874 |
|
| 875 |
|
| 876 |
async def main() -> None: |
| 877 |
await client.connections.update( |
| 878 |
id="id", |
| 879 |
) |
| 880 |
|
| 881 |
|
| 882 |
asyncio.run(main()) |
| 883 |
""" |
| 884 |
_response = await self._raw_client.update( |
| 885 |
id, |
| 886 |
display_name=display_name, |
| 887 |
options=options, |
| 888 |
enabled_clients=enabled_clients, |
| 889 |
is_domain_connection=is_domain_connection, |
| 890 |
show_as_button=show_as_button, |
| 891 |
realms=realms, |
| 892 |
metadata=metadata, |
| 893 |
authentication=authentication, |
| 894 |
connected_accounts=connected_accounts, |
| 895 |
cross_app_access_requesting_app=cross_app_access_requesting_app, |
| 896 |
cross_app_access_resource_app=cross_app_access_resource_app, |
| 897 |
request_options=request_options, |
| 898 |
) |
| 899 |
return _response.data |
| 900 |
|
| 901 |
async def check_status(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 902 |
""" |
| 903 |
Retrieves the status of an ad/ldap connection referenced by its `ID`. `200 OK` http status code response is returned when the connection is online, otherwise a `404` status code is returned along with an error message |
| 904 |
|
| 905 |
Parameters |
| 906 |
---------- |
| 907 |
id : str |
| 908 |
ID of the connection to check |
| 909 |
|
| 910 |
request_options : typing.Optional[RequestOptions] |
| 911 |
Request-specific configuration. |
| 912 |
|
| 913 |
Returns |
| 914 |
------- |
| 915 |
None |
| 916 |
|
| 917 |
Examples |
| 918 |
-------- |
| 919 |
import asyncio |
| 920 |
|
| 921 |
from auth0 import AsyncAuth0 |
| 922 |
|
| 923 |
client = AsyncAuth0( |
| 924 |
token="YOUR_TOKEN", |
| 925 |
) |
| 926 |
|
| 927 |
|
| 928 |
async def main() -> None: |
| 929 |
await client.connections.check_status( |
| 930 |
id="id", |
| 931 |
) |
| 932 |
|
| 933 |
|
| 934 |
asyncio.run(main()) |
| 935 |
""" |
| 936 |
_response = await self._raw_client.check_status(id, request_options=request_options) |
| 937 |
return _response.data |
| 938 |
|
| 939 |
@property |
| 940 |
def directory_provisioning(self): |
| 941 |
if self._directory_provisioning is None: |
| 942 |
from .directory_provisioning.client import AsyncDirectoryProvisioningClient |
| 943 |
|
| 944 |
self._directory_provisioning = AsyncDirectoryProvisioningClient(client_wrapper=self._client_wrapper) |
| 945 |
return self._directory_provisioning |
| 946 |
|
| 947 |
@property |
| 948 |
def scim_configuration(self): |
| 949 |
if self._scim_configuration is None: |
| 950 |
from .scim_configuration.client import AsyncScimConfigurationClient |
| 951 |
|
| 952 |
self._scim_configuration = AsyncScimConfigurationClient(client_wrapper=self._client_wrapper) |
| 953 |
return self._scim_configuration |
| 954 |
|
| 955 |
@property |
| 956 |
def clients(self): |
| 957 |
if self._clients is None: |
| 958 |
from .clients.client import AsyncClientsClient |
| 959 |
|
| 960 |
self._clients = AsyncClientsClient(client_wrapper=self._client_wrapper) |
| 961 |
return self._clients |
| 962 |
|
| 963 |
@property |
| 964 |
def keys(self): |
| 965 |
if self._keys is None: |
| 966 |
from .keys.client import AsyncKeysClient |
| 967 |
|
| 968 |
self._keys = AsyncKeysClient(client_wrapper=self._client_wrapper) |
| 969 |
return self._keys |
| 970 |
|
| 971 |
@property |
| 972 |
def users(self): |
| 973 |
if self._users is None: |
| 974 |
from .users.client import AsyncUsersClient |
| 975 |
|
| 976 |
self._users = AsyncUsersClient(client_wrapper=self._client_wrapper) |
| 977 |
return self._users |