| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ..core.request_options import RequestOptions |
| 7 |
from ..types.create_custom_domain_response_content import CreateCustomDomainResponseContent |
| 8 |
from ..types.custom_domain_custom_client_ip_header import CustomDomainCustomClientIpHeader |
| 9 |
from ..types.custom_domain_provisioning_type_enum import CustomDomainProvisioningTypeEnum |
| 10 |
from ..types.custom_domain_tls_policy_enum import CustomDomainTlsPolicyEnum |
| 11 |
from ..types.custom_domain_verification_method_enum import CustomDomainVerificationMethodEnum |
| 12 |
from ..types.domain_metadata import DomainMetadata |
| 13 |
from ..types.get_custom_domain_response_content import GetCustomDomainResponseContent |
| 14 |
from ..types.get_default_domain_response_content import GetDefaultDomainResponseContent |
| 15 |
from ..types.list_custom_domains_response_content import ListCustomDomainsResponseContent |
| 16 |
from ..types.test_custom_domain_response_content import TestCustomDomainResponseContent |
| 17 |
from ..types.update_custom_domain_response_content import UpdateCustomDomainResponseContent |
| 18 |
from ..types.update_default_domain_response_content import UpdateDefaultDomainResponseContent |
| 19 |
from ..types.verify_custom_domain_response_content import VerifyCustomDomainResponseContent |
| 20 |
from .raw_client import AsyncRawCustomDomainsClient, RawCustomDomainsClient |
| 21 |
|
| 22 |
|
| 23 |
OMIT = typing.cast(typing.Any, ...) |
| 24 |
|
| 25 |
|
| 26 |
class CustomDomainsClient: |
| 27 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 28 |
self._raw_client = RawCustomDomainsClient(client_wrapper=client_wrapper) |
| 29 |
|
| 30 |
@property |
| 31 |
def with_raw_response(self) -> RawCustomDomainsClient: |
| 32 |
""" |
| 33 |
Retrieves a raw implementation of this client that returns raw responses. |
| 34 |
|
| 35 |
Returns |
| 36 |
------- |
| 37 |
RawCustomDomainsClient |
| 38 |
""" |
| 39 |
return self._raw_client |
| 40 |
|
| 41 |
def list( |
| 42 |
self, |
| 43 |
*, |
| 44 |
q: typing.Optional[str] = None, |
| 45 |
fields: typing.Optional[str] = None, |
| 46 |
include_fields: typing.Optional[bool] = None, |
| 47 |
sort: typing.Optional[str] = None, |
| 48 |
request_options: typing.Optional[RequestOptions] = None, |
| 49 |
) -> ListCustomDomainsResponseContent: |
| 50 |
""" |
| 51 |
Retrieve details on [custom domains](https://auth0.com/docs/custom-domains). |
| 52 |
|
| 53 |
Parameters |
| 54 |
---------- |
| 55 |
q : typing.Optional[str] |
| 56 |
Query in <a href ="https://lucene.apache.org/core/2_9_4/queryparsersyntax.html">Lucene query string syntax</a>. |
| 57 |
|
| 58 |
fields : typing.Optional[str] |
| 59 |
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields. |
| 60 |
|
| 61 |
include_fields : typing.Optional[bool] |
| 62 |
Whether specified fields are to be included (true) or excluded (false). |
| 63 |
|
| 64 |
sort : typing.Optional[str] |
| 65 |
Field to sort by. Only <code>domain:1</code> (ascending order by domain) is supported at this time. |
| 66 |
|
| 67 |
request_options : typing.Optional[RequestOptions] |
| 68 |
Request-specific configuration. |
| 69 |
|
| 70 |
Returns |
| 71 |
------- |
| 72 |
ListCustomDomainsResponseContent |
| 73 |
Custom domains successfully retrieved. |
| 74 |
|
| 75 |
Examples |
| 76 |
-------- |
| 77 |
from auth0 import Auth0 |
| 78 |
|
| 79 |
client = Auth0( |
| 80 |
token="YOUR_TOKEN", |
| 81 |
) |
| 82 |
client.custom_domains.list( |
| 83 |
q="q", |
| 84 |
fields="fields", |
| 85 |
include_fields=True, |
| 86 |
sort="sort", |
| 87 |
) |
| 88 |
""" |
| 89 |
_response = self._raw_client.list( |
| 90 |
q=q, fields=fields, include_fields=include_fields, sort=sort, request_options=request_options |
| 91 |
) |
| 92 |
return _response.data |
| 93 |
|
| 94 |
def create( |
| 95 |
self, |
| 96 |
*, |
| 97 |
domain: str, |
| 98 |
type: CustomDomainProvisioningTypeEnum, |
| 99 |
verification_method: typing.Optional[CustomDomainVerificationMethodEnum] = OMIT, |
| 100 |
tls_policy: typing.Optional[CustomDomainTlsPolicyEnum] = OMIT, |
| 101 |
custom_client_ip_header: typing.Optional[CustomDomainCustomClientIpHeader] = OMIT, |
| 102 |
domain_metadata: typing.Optional[DomainMetadata] = OMIT, |
| 103 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 104 |
request_options: typing.Optional[RequestOptions] = None, |
| 105 |
) -> CreateCustomDomainResponseContent: |
| 106 |
""" |
| 107 |
Create a new custom domain. |
| 108 |
|
| 109 |
Note: The custom domain will need to be verified before it will accept |
| 110 |
requests. |
| 111 |
|
| 112 |
Optional attributes that can be updated: |
| 113 |
|
| 114 |
- custom_client_ip_header |
| 115 |
- tls_policy |
| 116 |
|
| 117 |
TLS Policies: |
| 118 |
|
| 119 |
- recommended - for modern usage this includes TLS 1.2 only |
| 120 |
|
| 121 |
Parameters |
| 122 |
---------- |
| 123 |
domain : str |
| 124 |
Domain name. |
| 125 |
|
| 126 |
type : CustomDomainProvisioningTypeEnum |
| 127 |
|
| 128 |
verification_method : typing.Optional[CustomDomainVerificationMethodEnum] |
| 129 |
|
| 130 |
tls_policy : typing.Optional[CustomDomainTlsPolicyEnum] |
| 131 |
|
| 132 |
custom_client_ip_header : typing.Optional[CustomDomainCustomClientIpHeader] |
| 133 |
|
| 134 |
domain_metadata : typing.Optional[DomainMetadata] |
| 135 |
|
| 136 |
relying_party_identifier : typing.Optional[str] |
| 137 |
Relying Party ID (rpId) to be used for Passkeys on this custom domain. If not provided, the full domain will be used. |
| 138 |
|
| 139 |
request_options : typing.Optional[RequestOptions] |
| 140 |
Request-specific configuration. |
| 141 |
|
| 142 |
Returns |
| 143 |
------- |
| 144 |
CreateCustomDomainResponseContent |
| 145 |
Custom domain successfully created (verification is pending). |
| 146 |
|
| 147 |
Examples |
| 148 |
-------- |
| 149 |
from auth0 import Auth0 |
| 150 |
|
| 151 |
client = Auth0( |
| 152 |
token="YOUR_TOKEN", |
| 153 |
) |
| 154 |
client.custom_domains.create( |
| 155 |
domain="domain", |
| 156 |
type="auth0_managed_certs", |
| 157 |
) |
| 158 |
""" |
| 159 |
_response = self._raw_client.create( |
| 160 |
domain=domain, |
| 161 |
type=type, |
| 162 |
verification_method=verification_method, |
| 163 |
tls_policy=tls_policy, |
| 164 |
custom_client_ip_header=custom_client_ip_header, |
| 165 |
domain_metadata=domain_metadata, |
| 166 |
relying_party_identifier=relying_party_identifier, |
| 167 |
request_options=request_options, |
| 168 |
) |
| 169 |
return _response.data |
| 170 |
|
| 171 |
def get_default( |
| 172 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 173 |
) -> GetDefaultDomainResponseContent: |
| 174 |
""" |
| 175 |
Retrieve the tenant's default domain. |
| 176 |
|
| 177 |
Parameters |
| 178 |
---------- |
| 179 |
request_options : typing.Optional[RequestOptions] |
| 180 |
Request-specific configuration. |
| 181 |
|
| 182 |
Returns |
| 183 |
------- |
| 184 |
GetDefaultDomainResponseContent |
| 185 |
Default domain successfully retrieved. |
| 186 |
|
| 187 |
Examples |
| 188 |
-------- |
| 189 |
from auth0 import Auth0 |
| 190 |
|
| 191 |
client = Auth0( |
| 192 |
token="YOUR_TOKEN", |
| 193 |
) |
| 194 |
client.custom_domains.get_default() |
| 195 |
""" |
| 196 |
_response = self._raw_client.get_default(request_options=request_options) |
| 197 |
return _response.data |
| 198 |
|
| 199 |
def set_default( |
| 200 |
self, *, domain: str, request_options: typing.Optional[RequestOptions] = None |
| 201 |
) -> UpdateDefaultDomainResponseContent: |
| 202 |
""" |
| 203 |
Set the default custom domain for the tenant. |
| 204 |
|
| 205 |
Parameters |
| 206 |
---------- |
| 207 |
domain : str |
| 208 |
The domain to set as the default custom domain. Must be a verified custom domain or the canonical domain. |
| 209 |
|
| 210 |
request_options : typing.Optional[RequestOptions] |
| 211 |
Request-specific configuration. |
| 212 |
|
| 213 |
Returns |
| 214 |
------- |
| 215 |
UpdateDefaultDomainResponseContent |
| 216 |
Default custom domain set successfully. |
| 217 |
|
| 218 |
Examples |
| 219 |
-------- |
| 220 |
from auth0 import Auth0 |
| 221 |
|
| 222 |
client = Auth0( |
| 223 |
token="YOUR_TOKEN", |
| 224 |
) |
| 225 |
client.custom_domains.set_default( |
| 226 |
domain="domain", |
| 227 |
) |
| 228 |
""" |
| 229 |
_response = self._raw_client.set_default(domain=domain, request_options=request_options) |
| 230 |
return _response.data |
| 231 |
|
| 232 |
def get( |
| 233 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 234 |
) -> GetCustomDomainResponseContent: |
| 235 |
""" |
| 236 |
Retrieve a custom domain configuration and status. |
| 237 |
|
| 238 |
Parameters |
| 239 |
---------- |
| 240 |
id : str |
| 241 |
ID of the custom domain to retrieve. |
| 242 |
|
| 243 |
request_options : typing.Optional[RequestOptions] |
| 244 |
Request-specific configuration. |
| 245 |
|
| 246 |
Returns |
| 247 |
------- |
| 248 |
GetCustomDomainResponseContent |
| 249 |
Custom domain successfully retrieved. |
| 250 |
|
| 251 |
Examples |
| 252 |
-------- |
| 253 |
from auth0 import Auth0 |
| 254 |
|
| 255 |
client = Auth0( |
| 256 |
token="YOUR_TOKEN", |
| 257 |
) |
| 258 |
client.custom_domains.get( |
| 259 |
id="id", |
| 260 |
) |
| 261 |
""" |
| 262 |
_response = self._raw_client.get(id, request_options=request_options) |
| 263 |
return _response.data |
| 264 |
|
| 265 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 266 |
""" |
| 267 |
Delete a custom domain and stop serving requests for it. |
| 268 |
|
| 269 |
Parameters |
| 270 |
---------- |
| 271 |
id : str |
| 272 |
ID of the custom domain to delete. |
| 273 |
|
| 274 |
request_options : typing.Optional[RequestOptions] |
| 275 |
Request-specific configuration. |
| 276 |
|
| 277 |
Returns |
| 278 |
------- |
| 279 |
None |
| 280 |
|
| 281 |
Examples |
| 282 |
-------- |
| 283 |
from auth0 import Auth0 |
| 284 |
|
| 285 |
client = Auth0( |
| 286 |
token="YOUR_TOKEN", |
| 287 |
) |
| 288 |
client.custom_domains.delete( |
| 289 |
id="id", |
| 290 |
) |
| 291 |
""" |
| 292 |
_response = self._raw_client.delete(id, request_options=request_options) |
| 293 |
return _response.data |
| 294 |
|
| 295 |
def update( |
| 296 |
self, |
| 297 |
id: str, |
| 298 |
*, |
| 299 |
tls_policy: typing.Optional[CustomDomainTlsPolicyEnum] = OMIT, |
| 300 |
custom_client_ip_header: typing.Optional[CustomDomainCustomClientIpHeader] = OMIT, |
| 301 |
domain_metadata: typing.Optional[DomainMetadata] = OMIT, |
| 302 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 303 |
request_options: typing.Optional[RequestOptions] = None, |
| 304 |
) -> UpdateCustomDomainResponseContent: |
| 305 |
""" |
| 306 |
Update a custom domain. |
| 307 |
|
| 308 |
These are the attributes that can be updated: |
| 309 |
|
| 310 |
- custom_client_ip_header |
| 311 |
- tls_policy |
| 312 |
|
| 313 |
**Updating CUSTOM_CLIENT_IP_HEADER for a custom domain** |
| 314 |
|
| 315 |
To update the `custom_client_ip_header` for a domain, the body to |
| 316 |
send should be: |
| 317 |
|
| 318 |
```json |
| 319 |
{ "custom_client_ip_header": "cf-connecting-ip" } |
| 320 |
``` |
| 321 |
|
| 322 |
**Updating TLS_POLICY for a custom domain** |
| 323 |
|
| 324 |
To update the `tls_policy` for a domain, the body to send should be: |
| 325 |
|
| 326 |
```json |
| 327 |
{ "tls_policy": "recommended" } |
| 328 |
``` |
| 329 |
|
| 330 |
TLS Policies: |
| 331 |
|
| 332 |
- recommended - for modern usage this includes TLS 1.2 only |
| 333 |
|
| 334 |
Some considerations: |
| 335 |
|
| 336 |
- The TLS ciphers and protocols available in each TLS policy follow industry recommendations, and may be updated occasionally. |
| 337 |
- The `compatible` TLS policy is no longer supported. |
| 338 |
|
| 339 |
Parameters |
| 340 |
---------- |
| 341 |
id : str |
| 342 |
The id of the custom domain to update |
| 343 |
|
| 344 |
tls_policy : typing.Optional[CustomDomainTlsPolicyEnum] |
| 345 |
recommended includes TLS 1.2 |
| 346 |
|
| 347 |
custom_client_ip_header : typing.Optional[CustomDomainCustomClientIpHeader] |
| 348 |
|
| 349 |
domain_metadata : typing.Optional[DomainMetadata] |
| 350 |
|
| 351 |
relying_party_identifier : typing.Optional[str] |
| 352 |
Relying Party ID (rpId) to be used for Passkeys on this custom domain. Set to null to remove the rpId and fall back to using the full domain. |
| 353 |
|
| 354 |
request_options : typing.Optional[RequestOptions] |
| 355 |
Request-specific configuration. |
| 356 |
|
| 357 |
Returns |
| 358 |
------- |
| 359 |
UpdateCustomDomainResponseContent |
| 360 |
Custom domain updated. |
| 361 |
|
| 362 |
Examples |
| 363 |
-------- |
| 364 |
from auth0 import Auth0 |
| 365 |
|
| 366 |
client = Auth0( |
| 367 |
token="YOUR_TOKEN", |
| 368 |
) |
| 369 |
client.custom_domains.update( |
| 370 |
id="id", |
| 371 |
) |
| 372 |
""" |
| 373 |
_response = self._raw_client.update( |
| 374 |
id, |
| 375 |
tls_policy=tls_policy, |
| 376 |
custom_client_ip_header=custom_client_ip_header, |
| 377 |
domain_metadata=domain_metadata, |
| 378 |
relying_party_identifier=relying_party_identifier, |
| 379 |
request_options=request_options, |
| 380 |
) |
| 381 |
return _response.data |
| 382 |
|
| 383 |
def test( |
| 384 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 385 |
) -> TestCustomDomainResponseContent: |
| 386 |
""" |
| 387 |
Run the test process on a custom domain. |
| 388 |
|
| 389 |
Parameters |
| 390 |
---------- |
| 391 |
id : str |
| 392 |
ID of the custom domain to test. |
| 393 |
|
| 394 |
request_options : typing.Optional[RequestOptions] |
| 395 |
Request-specific configuration. |
| 396 |
|
| 397 |
Returns |
| 398 |
------- |
| 399 |
TestCustomDomainResponseContent |
| 400 |
Custom domain test successfully completed. |
| 401 |
|
| 402 |
Examples |
| 403 |
-------- |
| 404 |
from auth0 import Auth0 |
| 405 |
|
| 406 |
client = Auth0( |
| 407 |
token="YOUR_TOKEN", |
| 408 |
) |
| 409 |
client.custom_domains.test( |
| 410 |
id="id", |
| 411 |
) |
| 412 |
""" |
| 413 |
_response = self._raw_client.test(id, request_options=request_options) |
| 414 |
return _response.data |
| 415 |
|
| 416 |
def verify( |
| 417 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 418 |
) -> VerifyCustomDomainResponseContent: |
| 419 |
""" |
| 420 |
Run the verification process on a custom domain. |
| 421 |
|
| 422 |
Note: Check the `status` field to see its verification status. Once verification is complete, it may take up to 10 minutes before the custom domain can start accepting requests. |
| 423 |
|
| 424 |
For `self_managed_certs`, when the custom domain is verified for the first time, the response will also include the `cname_api_key` which you will need to configure your proxy. This key must be kept secret, and is used to validate the proxy requests. |
| 425 |
|
| 426 |
[Learn more](https://auth0.com/docs/custom-domains#step-2-verify-ownership) about verifying custom domains that use Auth0 Managed certificates. |
| 427 |
[Learn more](https://auth0.com/docs/custom-domains/self-managed-certificates#step-2-verify-ownership) about verifying custom domains that use Self Managed certificates. |
| 428 |
|
| 429 |
Parameters |
| 430 |
---------- |
| 431 |
id : str |
| 432 |
ID of the custom domain to verify. |
| 433 |
|
| 434 |
request_options : typing.Optional[RequestOptions] |
| 435 |
Request-specific configuration. |
| 436 |
|
| 437 |
Returns |
| 438 |
------- |
| 439 |
VerifyCustomDomainResponseContent |
| 440 |
Custom domain successfully verified. |
| 441 |
|
| 442 |
Examples |
| 443 |
-------- |
| 444 |
from auth0 import Auth0 |
| 445 |
|
| 446 |
client = Auth0( |
| 447 |
token="YOUR_TOKEN", |
| 448 |
) |
| 449 |
client.custom_domains.verify( |
| 450 |
id="id", |
| 451 |
) |
| 452 |
""" |
| 453 |
_response = self._raw_client.verify(id, request_options=request_options) |
| 454 |
return _response.data |
| 455 |
|
| 456 |
|
| 457 |
class AsyncCustomDomainsClient: |
| 458 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 459 |
self._raw_client = AsyncRawCustomDomainsClient(client_wrapper=client_wrapper) |
| 460 |
|
| 461 |
@property |
| 462 |
def with_raw_response(self) -> AsyncRawCustomDomainsClient: |
| 463 |
""" |
| 464 |
Retrieves a raw implementation of this client that returns raw responses. |
| 465 |
|
| 466 |
Returns |
| 467 |
------- |
| 468 |
AsyncRawCustomDomainsClient |
| 469 |
""" |
| 470 |
return self._raw_client |
| 471 |
|
| 472 |
async def list( |
| 473 |
self, |
| 474 |
*, |
| 475 |
q: typing.Optional[str] = None, |
| 476 |
fields: typing.Optional[str] = None, |
| 477 |
include_fields: typing.Optional[bool] = None, |
| 478 |
sort: typing.Optional[str] = None, |
| 479 |
request_options: typing.Optional[RequestOptions] = None, |
| 480 |
) -> ListCustomDomainsResponseContent: |
| 481 |
""" |
| 482 |
Retrieve details on [custom domains](https://auth0.com/docs/custom-domains). |
| 483 |
|
| 484 |
Parameters |
| 485 |
---------- |
| 486 |
q : typing.Optional[str] |
| 487 |
Query in <a href ="https://lucene.apache.org/core/2_9_4/queryparsersyntax.html">Lucene query string syntax</a>. |
| 488 |
|
| 489 |
fields : typing.Optional[str] |
| 490 |
Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields. |
| 491 |
|
| 492 |
include_fields : typing.Optional[bool] |
| 493 |
Whether specified fields are to be included (true) or excluded (false). |
| 494 |
|
| 495 |
sort : typing.Optional[str] |
| 496 |
Field to sort by. Only <code>domain:1</code> (ascending order by domain) is supported at this time. |
| 497 |
|
| 498 |
request_options : typing.Optional[RequestOptions] |
| 499 |
Request-specific configuration. |
| 500 |
|
| 501 |
Returns |
| 502 |
------- |
| 503 |
ListCustomDomainsResponseContent |
| 504 |
Custom domains successfully retrieved. |
| 505 |
|
| 506 |
Examples |
| 507 |
-------- |
| 508 |
import asyncio |
| 509 |
|
| 510 |
from auth0 import AsyncAuth0 |
| 511 |
|
| 512 |
client = AsyncAuth0( |
| 513 |
token="YOUR_TOKEN", |
| 514 |
) |
| 515 |
|
| 516 |
|
| 517 |
async def main() -> None: |
| 518 |
await client.custom_domains.list( |
| 519 |
q="q", |
| 520 |
fields="fields", |
| 521 |
include_fields=True, |
| 522 |
sort="sort", |
| 523 |
) |
| 524 |
|
| 525 |
|
| 526 |
asyncio.run(main()) |
| 527 |
""" |
| 528 |
_response = await self._raw_client.list( |
| 529 |
q=q, fields=fields, include_fields=include_fields, sort=sort, request_options=request_options |
| 530 |
) |
| 531 |
return _response.data |
| 532 |
|
| 533 |
async def create( |
| 534 |
self, |
| 535 |
*, |
| 536 |
domain: str, |
| 537 |
type: CustomDomainProvisioningTypeEnum, |
| 538 |
verification_method: typing.Optional[CustomDomainVerificationMethodEnum] = OMIT, |
| 539 |
tls_policy: typing.Optional[CustomDomainTlsPolicyEnum] = OMIT, |
| 540 |
custom_client_ip_header: typing.Optional[CustomDomainCustomClientIpHeader] = OMIT, |
| 541 |
domain_metadata: typing.Optional[DomainMetadata] = OMIT, |
| 542 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 543 |
request_options: typing.Optional[RequestOptions] = None, |
| 544 |
) -> CreateCustomDomainResponseContent: |
| 545 |
""" |
| 546 |
Create a new custom domain. |
| 547 |
|
| 548 |
Note: The custom domain will need to be verified before it will accept |
| 549 |
requests. |
| 550 |
|
| 551 |
Optional attributes that can be updated: |
| 552 |
|
| 553 |
- custom_client_ip_header |
| 554 |
- tls_policy |
| 555 |
|
| 556 |
TLS Policies: |
| 557 |
|
| 558 |
- recommended - for modern usage this includes TLS 1.2 only |
| 559 |
|
| 560 |
Parameters |
| 561 |
---------- |
| 562 |
domain : str |
| 563 |
Domain name. |
| 564 |
|
| 565 |
type : CustomDomainProvisioningTypeEnum |
| 566 |
|
| 567 |
verification_method : typing.Optional[CustomDomainVerificationMethodEnum] |
| 568 |
|
| 569 |
tls_policy : typing.Optional[CustomDomainTlsPolicyEnum] |
| 570 |
|
| 571 |
custom_client_ip_header : typing.Optional[CustomDomainCustomClientIpHeader] |
| 572 |
|
| 573 |
domain_metadata : typing.Optional[DomainMetadata] |
| 574 |
|
| 575 |
relying_party_identifier : typing.Optional[str] |
| 576 |
Relying Party ID (rpId) to be used for Passkeys on this custom domain. If not provided, the full domain will be used. |
| 577 |
|
| 578 |
request_options : typing.Optional[RequestOptions] |
| 579 |
Request-specific configuration. |
| 580 |
|
| 581 |
Returns |
| 582 |
------- |
| 583 |
CreateCustomDomainResponseContent |
| 584 |
Custom domain successfully created (verification is pending). |
| 585 |
|
| 586 |
Examples |
| 587 |
-------- |
| 588 |
import asyncio |
| 589 |
|
| 590 |
from auth0 import AsyncAuth0 |
| 591 |
|
| 592 |
client = AsyncAuth0( |
| 593 |
token="YOUR_TOKEN", |
| 594 |
) |
| 595 |
|
| 596 |
|
| 597 |
async def main() -> None: |
| 598 |
await client.custom_domains.create( |
| 599 |
domain="domain", |
| 600 |
type="auth0_managed_certs", |
| 601 |
) |
| 602 |
|
| 603 |
|
| 604 |
asyncio.run(main()) |
| 605 |
""" |
| 606 |
_response = await self._raw_client.create( |
| 607 |
domain=domain, |
| 608 |
type=type, |
| 609 |
verification_method=verification_method, |
| 610 |
tls_policy=tls_policy, |
| 611 |
custom_client_ip_header=custom_client_ip_header, |
| 612 |
domain_metadata=domain_metadata, |
| 613 |
relying_party_identifier=relying_party_identifier, |
| 614 |
request_options=request_options, |
| 615 |
) |
| 616 |
return _response.data |
| 617 |
|
| 618 |
async def get_default( |
| 619 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 620 |
) -> GetDefaultDomainResponseContent: |
| 621 |
""" |
| 622 |
Retrieve the tenant's default domain. |
| 623 |
|
| 624 |
Parameters |
| 625 |
---------- |
| 626 |
request_options : typing.Optional[RequestOptions] |
| 627 |
Request-specific configuration. |
| 628 |
|
| 629 |
Returns |
| 630 |
------- |
| 631 |
GetDefaultDomainResponseContent |
| 632 |
Default domain successfully retrieved. |
| 633 |
|
| 634 |
Examples |
| 635 |
-------- |
| 636 |
import asyncio |
| 637 |
|
| 638 |
from auth0 import AsyncAuth0 |
| 639 |
|
| 640 |
client = AsyncAuth0( |
| 641 |
token="YOUR_TOKEN", |
| 642 |
) |
| 643 |
|
| 644 |
|
| 645 |
async def main() -> None: |
| 646 |
await client.custom_domains.get_default() |
| 647 |
|
| 648 |
|
| 649 |
asyncio.run(main()) |
| 650 |
""" |
| 651 |
_response = await self._raw_client.get_default(request_options=request_options) |
| 652 |
return _response.data |
| 653 |
|
| 654 |
async def set_default( |
| 655 |
self, *, domain: str, request_options: typing.Optional[RequestOptions] = None |
| 656 |
) -> UpdateDefaultDomainResponseContent: |
| 657 |
""" |
| 658 |
Set the default custom domain for the tenant. |
| 659 |
|
| 660 |
Parameters |
| 661 |
---------- |
| 662 |
domain : str |
| 663 |
The domain to set as the default custom domain. Must be a verified custom domain or the canonical domain. |
| 664 |
|
| 665 |
request_options : typing.Optional[RequestOptions] |
| 666 |
Request-specific configuration. |
| 667 |
|
| 668 |
Returns |
| 669 |
------- |
| 670 |
UpdateDefaultDomainResponseContent |
| 671 |
Default custom domain set successfully. |
| 672 |
|
| 673 |
Examples |
| 674 |
-------- |
| 675 |
import asyncio |
| 676 |
|
| 677 |
from auth0 import AsyncAuth0 |
| 678 |
|
| 679 |
client = AsyncAuth0( |
| 680 |
token="YOUR_TOKEN", |
| 681 |
) |
| 682 |
|
| 683 |
|
| 684 |
async def main() -> None: |
| 685 |
await client.custom_domains.set_default( |
| 686 |
domain="domain", |
| 687 |
) |
| 688 |
|
| 689 |
|
| 690 |
asyncio.run(main()) |
| 691 |
""" |
| 692 |
_response = await self._raw_client.set_default(domain=domain, request_options=request_options) |
| 693 |
return _response.data |
| 694 |
|
| 695 |
async def get( |
| 696 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 697 |
) -> GetCustomDomainResponseContent: |
| 698 |
""" |
| 699 |
Retrieve a custom domain configuration and status. |
| 700 |
|
| 701 |
Parameters |
| 702 |
---------- |
| 703 |
id : str |
| 704 |
ID of the custom domain to retrieve. |
| 705 |
|
| 706 |
request_options : typing.Optional[RequestOptions] |
| 707 |
Request-specific configuration. |
| 708 |
|
| 709 |
Returns |
| 710 |
------- |
| 711 |
GetCustomDomainResponseContent |
| 712 |
Custom domain successfully retrieved. |
| 713 |
|
| 714 |
Examples |
| 715 |
-------- |
| 716 |
import asyncio |
| 717 |
|
| 718 |
from auth0 import AsyncAuth0 |
| 719 |
|
| 720 |
client = AsyncAuth0( |
| 721 |
token="YOUR_TOKEN", |
| 722 |
) |
| 723 |
|
| 724 |
|
| 725 |
async def main() -> None: |
| 726 |
await client.custom_domains.get( |
| 727 |
id="id", |
| 728 |
) |
| 729 |
|
| 730 |
|
| 731 |
asyncio.run(main()) |
| 732 |
""" |
| 733 |
_response = await self._raw_client.get(id, request_options=request_options) |
| 734 |
return _response.data |
| 735 |
|
| 736 |
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 737 |
""" |
| 738 |
Delete a custom domain and stop serving requests for it. |
| 739 |
|
| 740 |
Parameters |
| 741 |
---------- |
| 742 |
id : str |
| 743 |
ID of the custom domain to delete. |
| 744 |
|
| 745 |
request_options : typing.Optional[RequestOptions] |
| 746 |
Request-specific configuration. |
| 747 |
|
| 748 |
Returns |
| 749 |
------- |
| 750 |
None |
| 751 |
|
| 752 |
Examples |
| 753 |
-------- |
| 754 |
import asyncio |
| 755 |
|
| 756 |
from auth0 import AsyncAuth0 |
| 757 |
|
| 758 |
client = AsyncAuth0( |
| 759 |
token="YOUR_TOKEN", |
| 760 |
) |
| 761 |
|
| 762 |
|
| 763 |
async def main() -> None: |
| 764 |
await client.custom_domains.delete( |
| 765 |
id="id", |
| 766 |
) |
| 767 |
|
| 768 |
|
| 769 |
asyncio.run(main()) |
| 770 |
""" |
| 771 |
_response = await self._raw_client.delete(id, request_options=request_options) |
| 772 |
return _response.data |
| 773 |
|
| 774 |
async def update( |
| 775 |
self, |
| 776 |
id: str, |
| 777 |
*, |
| 778 |
tls_policy: typing.Optional[CustomDomainTlsPolicyEnum] = OMIT, |
| 779 |
custom_client_ip_header: typing.Optional[CustomDomainCustomClientIpHeader] = OMIT, |
| 780 |
domain_metadata: typing.Optional[DomainMetadata] = OMIT, |
| 781 |
relying_party_identifier: typing.Optional[str] = OMIT, |
| 782 |
request_options: typing.Optional[RequestOptions] = None, |
| 783 |
) -> UpdateCustomDomainResponseContent: |
| 784 |
""" |
| 785 |
Update a custom domain. |
| 786 |
|
| 787 |
These are the attributes that can be updated: |
| 788 |
|
| 789 |
- custom_client_ip_header |
| 790 |
- tls_policy |
| 791 |
|
| 792 |
**Updating CUSTOM_CLIENT_IP_HEADER for a custom domain** |
| 793 |
|
| 794 |
To update the `custom_client_ip_header` for a domain, the body to |
| 795 |
send should be: |
| 796 |
|
| 797 |
```json |
| 798 |
{ "custom_client_ip_header": "cf-connecting-ip" } |
| 799 |
``` |
| 800 |
|
| 801 |
**Updating TLS_POLICY for a custom domain** |
| 802 |
|
| 803 |
To update the `tls_policy` for a domain, the body to send should be: |
| 804 |
|
| 805 |
```json |
| 806 |
{ "tls_policy": "recommended" } |
| 807 |
``` |
| 808 |
|
| 809 |
TLS Policies: |
| 810 |
|
| 811 |
- recommended - for modern usage this includes TLS 1.2 only |
| 812 |
|
| 813 |
Some considerations: |
| 814 |
|
| 815 |
- The TLS ciphers and protocols available in each TLS policy follow industry recommendations, and may be updated occasionally. |
| 816 |
- The `compatible` TLS policy is no longer supported. |
| 817 |
|
| 818 |
Parameters |
| 819 |
---------- |
| 820 |
id : str |
| 821 |
The id of the custom domain to update |
| 822 |
|
| 823 |
tls_policy : typing.Optional[CustomDomainTlsPolicyEnum] |
| 824 |
recommended includes TLS 1.2 |
| 825 |
|
| 826 |
custom_client_ip_header : typing.Optional[CustomDomainCustomClientIpHeader] |
| 827 |
|
| 828 |
domain_metadata : typing.Optional[DomainMetadata] |
| 829 |
|
| 830 |
relying_party_identifier : typing.Optional[str] |
| 831 |
Relying Party ID (rpId) to be used for Passkeys on this custom domain. Set to null to remove the rpId and fall back to using the full domain. |
| 832 |
|
| 833 |
request_options : typing.Optional[RequestOptions] |
| 834 |
Request-specific configuration. |
| 835 |
|
| 836 |
Returns |
| 837 |
------- |
| 838 |
UpdateCustomDomainResponseContent |
| 839 |
Custom domain updated. |
| 840 |
|
| 841 |
Examples |
| 842 |
-------- |
| 843 |
import asyncio |
| 844 |
|
| 845 |
from auth0 import AsyncAuth0 |
| 846 |
|
| 847 |
client = AsyncAuth0( |
| 848 |
token="YOUR_TOKEN", |
| 849 |
) |
| 850 |
|
| 851 |
|
| 852 |
async def main() -> None: |
| 853 |
await client.custom_domains.update( |
| 854 |
id="id", |
| 855 |
) |
| 856 |
|
| 857 |
|
| 858 |
asyncio.run(main()) |
| 859 |
""" |
| 860 |
_response = await self._raw_client.update( |
| 861 |
id, |
| 862 |
tls_policy=tls_policy, |
| 863 |
custom_client_ip_header=custom_client_ip_header, |
| 864 |
domain_metadata=domain_metadata, |
| 865 |
relying_party_identifier=relying_party_identifier, |
| 866 |
request_options=request_options, |
| 867 |
) |
| 868 |
return _response.data |
| 869 |
|
| 870 |
async def test( |
| 871 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 872 |
) -> TestCustomDomainResponseContent: |
| 873 |
""" |
| 874 |
Run the test process on a custom domain. |
| 875 |
|
| 876 |
Parameters |
| 877 |
---------- |
| 878 |
id : str |
| 879 |
ID of the custom domain to test. |
| 880 |
|
| 881 |
request_options : typing.Optional[RequestOptions] |
| 882 |
Request-specific configuration. |
| 883 |
|
| 884 |
Returns |
| 885 |
------- |
| 886 |
TestCustomDomainResponseContent |
| 887 |
Custom domain test successfully completed. |
| 888 |
|
| 889 |
Examples |
| 890 |
-------- |
| 891 |
import asyncio |
| 892 |
|
| 893 |
from auth0 import AsyncAuth0 |
| 894 |
|
| 895 |
client = AsyncAuth0( |
| 896 |
token="YOUR_TOKEN", |
| 897 |
) |
| 898 |
|
| 899 |
|
| 900 |
async def main() -> None: |
| 901 |
await client.custom_domains.test( |
| 902 |
id="id", |
| 903 |
) |
| 904 |
|
| 905 |
|
| 906 |
asyncio.run(main()) |
| 907 |
""" |
| 908 |
_response = await self._raw_client.test(id, request_options=request_options) |
| 909 |
return _response.data |
| 910 |
|
| 911 |
async def verify( |
| 912 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 913 |
) -> VerifyCustomDomainResponseContent: |
| 914 |
""" |
| 915 |
Run the verification process on a custom domain. |
| 916 |
|
| 917 |
Note: Check the `status` field to see its verification status. Once verification is complete, it may take up to 10 minutes before the custom domain can start accepting requests. |
| 918 |
|
| 919 |
For `self_managed_certs`, when the custom domain is verified for the first time, the response will also include the `cname_api_key` which you will need to configure your proxy. This key must be kept secret, and is used to validate the proxy requests. |
| 920 |
|
| 921 |
[Learn more](https://auth0.com/docs/custom-domains#step-2-verify-ownership) about verifying custom domains that use Auth0 Managed certificates. |
| 922 |
[Learn more](https://auth0.com/docs/custom-domains/self-managed-certificates#step-2-verify-ownership) about verifying custom domains that use Self Managed certificates. |
| 923 |
|
| 924 |
Parameters |
| 925 |
---------- |
| 926 |
id : str |
| 927 |
ID of the custom domain to verify. |
| 928 |
|
| 929 |
request_options : typing.Optional[RequestOptions] |
| 930 |
Request-specific configuration. |
| 931 |
|
| 932 |
Returns |
| 933 |
------- |
| 934 |
VerifyCustomDomainResponseContent |
| 935 |
Custom domain successfully verified. |
| 936 |
|
| 937 |
Examples |
| 938 |
-------- |
| 939 |
import asyncio |
| 940 |
|
| 941 |
from auth0 import AsyncAuth0 |
| 942 |
|
| 943 |
client = AsyncAuth0( |
| 944 |
token="YOUR_TOKEN", |
| 945 |
) |
| 946 |
|
| 947 |
|
| 948 |
async def main() -> None: |
| 949 |
await client.custom_domains.verify( |
| 950 |
id="id", |
| 951 |
) |
| 952 |
|
| 953 |
|
| 954 |
asyncio.run(main()) |
| 955 |
""" |
| 956 |
_response = await self._raw_client.verify(id, request_options=request_options) |
| 957 |
return _response.data |