Debian Codegraph @

src/auth0/management/tenants/settings/raw_client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4 from json.decoder import JSONDecodeError
5
6 from ...core.api_error import ApiError
7 from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8 from ...core.http_response import AsyncHttpResponse, HttpResponse
9 from ...core.parse_error import ParsingError
10 from ...core.pydantic_utilities import parse_obj_as
11 from ...core.request_options import RequestOptions
12 from ...core.serialization import convert_and_respect_annotation_metadata
13 from ...errors.bad_request_error import BadRequestError
14 from ...errors.forbidden_error import ForbiddenError
15 from ...errors.too_many_requests_error import TooManyRequestsError
16 from ...errors.unauthorized_error import UnauthorizedError
17 from ...types.default_token_quota import DefaultTokenQuota
18 from ...types.get_tenant_settings_response_content import GetTenantSettingsResponseContent
19 from ...types.session_cookie_schema import SessionCookieSchema
20 from ...types.tenant_oidc_logout_settings import TenantOidcLogoutSettings
21 from ...types.tenant_settings_country_codes import TenantSettingsCountryCodes
22 from ...types.tenant_settings_device_flow import TenantSettingsDeviceFlow
23 from ...types.tenant_settings_dynamic_client_registration_security_mode import (
24 TenantSettingsDynamicClientRegistrationSecurityMode,
25 )
26 from ...types.tenant_settings_error_page import TenantSettingsErrorPage
27 from ...types.tenant_settings_flags import TenantSettingsFlags
28 from ...types.tenant_settings_guardian_page import TenantSettingsGuardianPage
29 from ...types.tenant_settings_mtls import TenantSettingsMtls
30 from ...types.tenant_settings_nullable_security_headers import TenantSettingsNullableSecurityHeaders
31 from ...types.tenant_settings_password_page import TenantSettingsPasswordPage
32 from ...types.tenant_settings_resource_parameter_profile import TenantSettingsResourceParameterProfile
33 from ...types.tenant_settings_sessions import TenantSettingsSessions
34 from ...types.tenant_settings_supported_locales_enum import TenantSettingsSupportedLocalesEnum
35 from ...types.update_tenant_settings_response_content import UpdateTenantSettingsResponseContent
36 from pydantic import ValidationError
37
38 # this is used as the default value for optional parameters
39 OMIT = typing.cast(typing.Any, ...)
40
41
42 class RawSettingsClient:
43 def __init__(self, *, client_wrapper: SyncClientWrapper):
44 self._client_wrapper = client_wrapper
45
46 def get(
47 self,
48 *,
49 fields: typing.Optional[str] = None,
50 include_fields: typing.Optional[bool] = None,
51 request_options: typing.Optional[RequestOptions] = None,
52 ) -> HttpResponse[GetTenantSettingsResponseContent]:
53 """
54 Retrieve tenant settings. A list of fields to include or exclude may also be specified.
55
56 Parameters
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 request_options : typing.Optional[RequestOptions]
65 Request-specific configuration.
66
67 Returns
68 -------
69 HttpResponse[GetTenantSettingsResponseContent]
70 Tenant settings successfully retrieved.
71 """
72 _response = self._client_wrapper.httpx_client.request(
73 "tenants/settings",
74 method="GET",
75 params={
76 "fields": fields,
77 "include_fields": include_fields,
78 },
79 request_options=request_options,
80 )
81 try:
82 if 200 <= _response.status_code < 300:
83 _data = typing.cast(
84 GetTenantSettingsResponseContent,
85 parse_obj_as(
86 type_=GetTenantSettingsResponseContent, # type: ignore
87 object_=_response.json(),
88 ),
89 )
90 return HttpResponse(response=_response, data=_data)
91 if _response.status_code == 400:
92 raise BadRequestError(
93 headers=dict(_response.headers),
94 body=typing.cast(
95 typing.Any,
96 parse_obj_as(
97 type_=typing.Any, # type: ignore
98 object_=_response.json(),
99 ),
100 ),
101 )
102 if _response.status_code == 401:
103 raise UnauthorizedError(
104 headers=dict(_response.headers),
105 body=typing.cast(
106 typing.Any,
107 parse_obj_as(
108 type_=typing.Any, # type: ignore
109 object_=_response.json(),
110 ),
111 ),
112 )
113 if _response.status_code == 403:
114 raise ForbiddenError(
115 headers=dict(_response.headers),
116 body=typing.cast(
117 typing.Any,
118 parse_obj_as(
119 type_=typing.Any, # type: ignore
120 object_=_response.json(),
121 ),
122 ),
123 )
124 if _response.status_code == 429:
125 raise TooManyRequestsError(
126 headers=dict(_response.headers),
127 body=typing.cast(
128 typing.Any,
129 parse_obj_as(
130 type_=typing.Any, # type: ignore
131 object_=_response.json(),
132 ),
133 ),
134 )
135 _response_json = _response.json()
136 except JSONDecodeError:
137 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
138 except ValidationError as e:
139 raise ParsingError(
140 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
141 )
142 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
143
144 def update(
145 self,
146 *,
147 change_password: typing.Optional[TenantSettingsPasswordPage] = OMIT,
148 device_flow: typing.Optional[TenantSettingsDeviceFlow] = OMIT,
149 guardian_mfa_page: typing.Optional[TenantSettingsGuardianPage] = OMIT,
150 default_audience: typing.Optional[str] = OMIT,
151 default_directory: typing.Optional[str] = OMIT,
152 error_page: typing.Optional[TenantSettingsErrorPage] = OMIT,
153 default_token_quota: typing.Optional[DefaultTokenQuota] = OMIT,
154 flags: typing.Optional[TenantSettingsFlags] = OMIT,
155 friendly_name: typing.Optional[str] = OMIT,
156 picture_url: typing.Optional[str] = OMIT,
157 support_email: typing.Optional[str] = OMIT,
158 support_url: typing.Optional[str] = OMIT,
159 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
160 session_lifetime: typing.Optional[int] = OMIT,
161 session_lifetime_in_minutes: typing.Optional[int] = OMIT,
162 idle_session_lifetime: typing.Optional[int] = OMIT,
163 idle_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
164 ephemeral_session_lifetime: typing.Optional[int] = OMIT,
165 idle_ephemeral_session_lifetime: typing.Optional[int] = OMIT,
166 ephemeral_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
167 idle_ephemeral_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
168 sandbox_version: typing.Optional[str] = OMIT,
169 legacy_sandbox_version: typing.Optional[str] = OMIT,
170 default_redirection_uri: typing.Optional[str] = OMIT,
171 enabled_locales: typing.Optional[typing.Sequence[TenantSettingsSupportedLocalesEnum]] = OMIT,
172 security_headers: typing.Optional[TenantSettingsNullableSecurityHeaders] = OMIT,
173 session_cookie: typing.Optional[SessionCookieSchema] = OMIT,
174 sessions: typing.Optional[TenantSettingsSessions] = OMIT,
175 oidc_logout: typing.Optional[TenantOidcLogoutSettings] = OMIT,
176 customize_mfa_in_postlogin_action: typing.Optional[bool] = OMIT,
177 allow_organization_name_in_authentication_api: typing.Optional[bool] = OMIT,
178 acr_values_supported: typing.Optional[typing.Sequence[str]] = OMIT,
179 mtls: typing.Optional[TenantSettingsMtls] = OMIT,
180 pushed_authorization_requests_supported: typing.Optional[bool] = OMIT,
181 authorization_response_iss_parameter_supported: typing.Optional[bool] = OMIT,
182 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
183 resource_parameter_profile: typing.Optional[TenantSettingsResourceParameterProfile] = OMIT,
184 client_id_metadata_document_supported: typing.Optional[bool] = OMIT,
185 enable_ai_guide: typing.Optional[bool] = OMIT,
186 phone_consolidated_experience: typing.Optional[bool] = OMIT,
187 include_session_metadata_in_tenant_logs: typing.Optional[bool] = OMIT,
188 dynamic_client_registration_security_mode: typing.Optional[
189 TenantSettingsDynamicClientRegistrationSecurityMode
190 ] = OMIT,
191 country_codes: typing.Optional[TenantSettingsCountryCodes] = OMIT,
192 request_options: typing.Optional[RequestOptions] = None,
193 ) -> HttpResponse[UpdateTenantSettingsResponseContent]:
194 """
195 Update settings for a tenant.
196
197 Parameters
198 ----------
199 change_password : typing.Optional[TenantSettingsPasswordPage]
200
201 device_flow : typing.Optional[TenantSettingsDeviceFlow]
202 Device Flow configuration.
203
204 guardian_mfa_page : typing.Optional[TenantSettingsGuardianPage]
205
206 default_audience : typing.Optional[str]
207 Default audience for API Authorization.
208
209 default_directory : typing.Optional[str]
210 Name of connection used for password grants at the `/token` endpoint. The following connection types are supported: LDAP, AD, Database Connections, Passwordless, Windows Azure Active Directory, ADFS.
211
212 error_page : typing.Optional[TenantSettingsErrorPage]
213
214 default_token_quota : typing.Optional[DefaultTokenQuota]
215
216 flags : typing.Optional[TenantSettingsFlags]
217
218 friendly_name : typing.Optional[str]
219 Friendly name for this tenant.
220
221 picture_url : typing.Optional[str]
222 URL of logo to be shown for this tenant (recommended size: 150x150)
223
224 support_email : typing.Optional[str]
225 End-user support email.
226
227 support_url : typing.Optional[str]
228 End-user support url.
229
230 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
231 URLs that are valid to redirect to after logout from Auth0.
232
233 session_lifetime : typing.Optional[int]
234 Number of hours a session will stay valid.
235
236 session_lifetime_in_minutes : typing.Optional[int]
237 Number of minutes a session will stay valid. Cannot be specified together with `session_lifetime`.
238
239 idle_session_lifetime : typing.Optional[int]
240 Number of hours for which a session can be inactive before the user must log in again.
241
242 idle_session_lifetime_in_minutes : typing.Optional[int]
243 Number of minutes a session can be inactive before the user must log in again. Cannot be specified together with `idle_session_lifetime`.
244
245 ephemeral_session_lifetime : typing.Optional[int]
246 Number of hours an ephemeral (non-persistent) session will stay valid.
247
248 idle_ephemeral_session_lifetime : typing.Optional[int]
249 Number of hours for which an ephemeral (non-persistent) session can be inactive before the user must log in again.
250
251 ephemeral_session_lifetime_in_minutes : typing.Optional[int]
252 Number of minutes an ephemeral (non-persistent) session will stay valid. Cannot be specified together with `ephemeral_session_lifetime`.
253
254 idle_ephemeral_session_lifetime_in_minutes : typing.Optional[int]
255 Number of minutes an ephemeral (non-persistent) session can be inactive before the user must log in again. Cannot be specified together with `idle_ephemeral_session_lifetime`.
256
257 sandbox_version : typing.Optional[str]
258 Selected sandbox version for the extensibility environment
259
260 legacy_sandbox_version : typing.Optional[str]
261 Selected legacy sandbox version for the extensibility environment
262
263 default_redirection_uri : typing.Optional[str]
264 The default absolute redirection uri, must be https
265
266 enabled_locales : typing.Optional[typing.Sequence[TenantSettingsSupportedLocalesEnum]]
267 Supported locales for the user interface
268
269 security_headers : typing.Optional[TenantSettingsNullableSecurityHeaders]
270
271 session_cookie : typing.Optional[SessionCookieSchema]
272
273 sessions : typing.Optional[TenantSettingsSessions]
274
275 oidc_logout : typing.Optional[TenantOidcLogoutSettings]
276
277 customize_mfa_in_postlogin_action : typing.Optional[bool]
278 Whether to enable flexible factors for MFA in the PostLogin action
279
280 allow_organization_name_in_authentication_api : typing.Optional[bool]
281 Whether to accept an organization name instead of an ID on auth endpoints
282
283 acr_values_supported : typing.Optional[typing.Sequence[str]]
284 Supported ACR values
285
286 mtls : typing.Optional[TenantSettingsMtls]
287
288 pushed_authorization_requests_supported : typing.Optional[bool]
289 Enables the use of Pushed Authorization Requests
290
291 authorization_response_iss_parameter_supported : typing.Optional[bool]
292 Supports iss parameter in authorization responses
293
294 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
295 Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
296 If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
297 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
298
299 resource_parameter_profile : typing.Optional[TenantSettingsResourceParameterProfile]
300
301 client_id_metadata_document_supported : typing.Optional[bool]
302 Whether the authorization server supports retrieving client metadata from a client_id URL.
303
304 enable_ai_guide : typing.Optional[bool]
305 Whether Auth0 Guide (AI-powered assistance) is enabled for this tenant.
306
307 phone_consolidated_experience : typing.Optional[bool]
308 Whether Phone Consolidated Experience is enabled for this tenant.
309
310 include_session_metadata_in_tenant_logs : typing.Optional[bool]
311 Whether session metadata is included in specific tenant logs (slo, oidc_backchannel_logout_failed, oidc_backchannel_logout_succeeded).
312
313 dynamic_client_registration_security_mode : typing.Optional[TenantSettingsDynamicClientRegistrationSecurityMode]
314
315 country_codes : typing.Optional[TenantSettingsCountryCodes]
316
317 request_options : typing.Optional[RequestOptions]
318 Request-specific configuration.
319
320 Returns
321 -------
322 HttpResponse[UpdateTenantSettingsResponseContent]
323 Tenant settings successfully updated.
324 """
325 _response = self._client_wrapper.httpx_client.request(
326 "tenants/settings",
327 method="PATCH",
328 json={
329 "change_password": convert_and_respect_annotation_metadata(
330 object_=change_password, annotation=typing.Optional[TenantSettingsPasswordPage], direction="write"
331 ),
332 "device_flow": convert_and_respect_annotation_metadata(
333 object_=device_flow, annotation=typing.Optional[TenantSettingsDeviceFlow], direction="write"
334 ),
335 "guardian_mfa_page": convert_and_respect_annotation_metadata(
336 object_=guardian_mfa_page, annotation=typing.Optional[TenantSettingsGuardianPage], direction="write"
337 ),
338 "default_audience": default_audience,
339 "default_directory": default_directory,
340 "error_page": convert_and_respect_annotation_metadata(
341 object_=error_page, annotation=typing.Optional[TenantSettingsErrorPage], direction="write"
342 ),
343 "default_token_quota": convert_and_respect_annotation_metadata(
344 object_=default_token_quota, annotation=typing.Optional[DefaultTokenQuota], direction="write"
345 ),
346 "flags": convert_and_respect_annotation_metadata(
347 object_=flags, annotation=TenantSettingsFlags, direction="write"
348 ),
349 "friendly_name": friendly_name,
350 "picture_url": picture_url,
351 "support_email": support_email,
352 "support_url": support_url,
353 "allowed_logout_urls": allowed_logout_urls,
354 "session_lifetime": session_lifetime,
355 "session_lifetime_in_minutes": session_lifetime_in_minutes,
356 "idle_session_lifetime": idle_session_lifetime,
357 "idle_session_lifetime_in_minutes": idle_session_lifetime_in_minutes,
358 "ephemeral_session_lifetime": ephemeral_session_lifetime,
359 "idle_ephemeral_session_lifetime": idle_ephemeral_session_lifetime,
360 "ephemeral_session_lifetime_in_minutes": ephemeral_session_lifetime_in_minutes,
361 "idle_ephemeral_session_lifetime_in_minutes": idle_ephemeral_session_lifetime_in_minutes,
362 "sandbox_version": sandbox_version,
363 "legacy_sandbox_version": legacy_sandbox_version,
364 "default_redirection_uri": default_redirection_uri,
365 "enabled_locales": enabled_locales,
366 "security_headers": convert_and_respect_annotation_metadata(
367 object_=security_headers,
368 annotation=typing.Optional[TenantSettingsNullableSecurityHeaders],
369 direction="write",
370 ),
371 "session_cookie": convert_and_respect_annotation_metadata(
372 object_=session_cookie, annotation=typing.Optional[SessionCookieSchema], direction="write"
373 ),
374 "sessions": convert_and_respect_annotation_metadata(
375 object_=sessions, annotation=typing.Optional[TenantSettingsSessions], direction="write"
376 ),
377 "oidc_logout": convert_and_respect_annotation_metadata(
378 object_=oidc_logout, annotation=TenantOidcLogoutSettings, direction="write"
379 ),
380 "customize_mfa_in_postlogin_action": customize_mfa_in_postlogin_action,
381 "allow_organization_name_in_authentication_api": allow_organization_name_in_authentication_api,
382 "acr_values_supported": acr_values_supported,
383 "mtls": convert_and_respect_annotation_metadata(
384 object_=mtls, annotation=typing.Optional[TenantSettingsMtls], direction="write"
385 ),
386 "pushed_authorization_requests_supported": pushed_authorization_requests_supported,
387 "authorization_response_iss_parameter_supported": authorization_response_iss_parameter_supported,
388 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
389 "resource_parameter_profile": resource_parameter_profile,
390 "client_id_metadata_document_supported": client_id_metadata_document_supported,
391 "enable_ai_guide": enable_ai_guide,
392 "phone_consolidated_experience": phone_consolidated_experience,
393 "include_session_metadata_in_tenant_logs": include_session_metadata_in_tenant_logs,
394 "dynamic_client_registration_security_mode": dynamic_client_registration_security_mode,
395 "country_codes": convert_and_respect_annotation_metadata(
396 object_=country_codes, annotation=typing.Optional[TenantSettingsCountryCodes], direction="write"
397 ),
398 },
399 headers={
400 "content-type": "application/json",
401 },
402 request_options=request_options,
403 omit=OMIT,
404 )
405 try:
406 if 200 <= _response.status_code < 300:
407 _data = typing.cast(
408 UpdateTenantSettingsResponseContent,
409 parse_obj_as(
410 type_=UpdateTenantSettingsResponseContent, # type: ignore
411 object_=_response.json(),
412 ),
413 )
414 return HttpResponse(response=_response, data=_data)
415 if _response.status_code == 400:
416 raise BadRequestError(
417 headers=dict(_response.headers),
418 body=typing.cast(
419 typing.Any,
420 parse_obj_as(
421 type_=typing.Any, # type: ignore
422 object_=_response.json(),
423 ),
424 ),
425 )
426 if _response.status_code == 401:
427 raise UnauthorizedError(
428 headers=dict(_response.headers),
429 body=typing.cast(
430 typing.Any,
431 parse_obj_as(
432 type_=typing.Any, # type: ignore
433 object_=_response.json(),
434 ),
435 ),
436 )
437 if _response.status_code == 403:
438 raise ForbiddenError(
439 headers=dict(_response.headers),
440 body=typing.cast(
441 typing.Any,
442 parse_obj_as(
443 type_=typing.Any, # type: ignore
444 object_=_response.json(),
445 ),
446 ),
447 )
448 if _response.status_code == 429:
449 raise TooManyRequestsError(
450 headers=dict(_response.headers),
451 body=typing.cast(
452 typing.Any,
453 parse_obj_as(
454 type_=typing.Any, # type: ignore
455 object_=_response.json(),
456 ),
457 ),
458 )
459 _response_json = _response.json()
460 except JSONDecodeError:
461 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
462 except ValidationError as e:
463 raise ParsingError(
464 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
465 )
466 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
467
468
469 class AsyncRawSettingsClient:
470 def __init__(self, *, client_wrapper: AsyncClientWrapper):
471 self._client_wrapper = client_wrapper
472
473 async def get(
474 self,
475 *,
476 fields: typing.Optional[str] = None,
477 include_fields: typing.Optional[bool] = None,
478 request_options: typing.Optional[RequestOptions] = None,
479 ) -> AsyncHttpResponse[GetTenantSettingsResponseContent]:
480 """
481 Retrieve tenant settings. A list of fields to include or exclude may also be specified.
482
483 Parameters
484 ----------
485 fields : typing.Optional[str]
486 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.
487
488 include_fields : typing.Optional[bool]
489 Whether specified fields are to be included (true) or excluded (false).
490
491 request_options : typing.Optional[RequestOptions]
492 Request-specific configuration.
493
494 Returns
495 -------
496 AsyncHttpResponse[GetTenantSettingsResponseContent]
497 Tenant settings successfully retrieved.
498 """
499 _response = await self._client_wrapper.httpx_client.request(
500 "tenants/settings",
501 method="GET",
502 params={
503 "fields": fields,
504 "include_fields": include_fields,
505 },
506 request_options=request_options,
507 )
508 try:
509 if 200 <= _response.status_code < 300:
510 _data = typing.cast(
511 GetTenantSettingsResponseContent,
512 parse_obj_as(
513 type_=GetTenantSettingsResponseContent, # type: ignore
514 object_=_response.json(),
515 ),
516 )
517 return AsyncHttpResponse(response=_response, data=_data)
518 if _response.status_code == 400:
519 raise BadRequestError(
520 headers=dict(_response.headers),
521 body=typing.cast(
522 typing.Any,
523 parse_obj_as(
524 type_=typing.Any, # type: ignore
525 object_=_response.json(),
526 ),
527 ),
528 )
529 if _response.status_code == 401:
530 raise UnauthorizedError(
531 headers=dict(_response.headers),
532 body=typing.cast(
533 typing.Any,
534 parse_obj_as(
535 type_=typing.Any, # type: ignore
536 object_=_response.json(),
537 ),
538 ),
539 )
540 if _response.status_code == 403:
541 raise ForbiddenError(
542 headers=dict(_response.headers),
543 body=typing.cast(
544 typing.Any,
545 parse_obj_as(
546 type_=typing.Any, # type: ignore
547 object_=_response.json(),
548 ),
549 ),
550 )
551 if _response.status_code == 429:
552 raise TooManyRequestsError(
553 headers=dict(_response.headers),
554 body=typing.cast(
555 typing.Any,
556 parse_obj_as(
557 type_=typing.Any, # type: ignore
558 object_=_response.json(),
559 ),
560 ),
561 )
562 _response_json = _response.json()
563 except JSONDecodeError:
564 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
565 except ValidationError as e:
566 raise ParsingError(
567 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
568 )
569 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
570
571 async def update(
572 self,
573 *,
574 change_password: typing.Optional[TenantSettingsPasswordPage] = OMIT,
575 device_flow: typing.Optional[TenantSettingsDeviceFlow] = OMIT,
576 guardian_mfa_page: typing.Optional[TenantSettingsGuardianPage] = OMIT,
577 default_audience: typing.Optional[str] = OMIT,
578 default_directory: typing.Optional[str] = OMIT,
579 error_page: typing.Optional[TenantSettingsErrorPage] = OMIT,
580 default_token_quota: typing.Optional[DefaultTokenQuota] = OMIT,
581 flags: typing.Optional[TenantSettingsFlags] = OMIT,
582 friendly_name: typing.Optional[str] = OMIT,
583 picture_url: typing.Optional[str] = OMIT,
584 support_email: typing.Optional[str] = OMIT,
585 support_url: typing.Optional[str] = OMIT,
586 allowed_logout_urls: typing.Optional[typing.Sequence[str]] = OMIT,
587 session_lifetime: typing.Optional[int] = OMIT,
588 session_lifetime_in_minutes: typing.Optional[int] = OMIT,
589 idle_session_lifetime: typing.Optional[int] = OMIT,
590 idle_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
591 ephemeral_session_lifetime: typing.Optional[int] = OMIT,
592 idle_ephemeral_session_lifetime: typing.Optional[int] = OMIT,
593 ephemeral_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
594 idle_ephemeral_session_lifetime_in_minutes: typing.Optional[int] = OMIT,
595 sandbox_version: typing.Optional[str] = OMIT,
596 legacy_sandbox_version: typing.Optional[str] = OMIT,
597 default_redirection_uri: typing.Optional[str] = OMIT,
598 enabled_locales: typing.Optional[typing.Sequence[TenantSettingsSupportedLocalesEnum]] = OMIT,
599 security_headers: typing.Optional[TenantSettingsNullableSecurityHeaders] = OMIT,
600 session_cookie: typing.Optional[SessionCookieSchema] = OMIT,
601 sessions: typing.Optional[TenantSettingsSessions] = OMIT,
602 oidc_logout: typing.Optional[TenantOidcLogoutSettings] = OMIT,
603 customize_mfa_in_postlogin_action: typing.Optional[bool] = OMIT,
604 allow_organization_name_in_authentication_api: typing.Optional[bool] = OMIT,
605 acr_values_supported: typing.Optional[typing.Sequence[str]] = OMIT,
606 mtls: typing.Optional[TenantSettingsMtls] = OMIT,
607 pushed_authorization_requests_supported: typing.Optional[bool] = OMIT,
608 authorization_response_iss_parameter_supported: typing.Optional[bool] = OMIT,
609 skip_non_verifiable_callback_uri_confirmation_prompt: typing.Optional[bool] = OMIT,
610 resource_parameter_profile: typing.Optional[TenantSettingsResourceParameterProfile] = OMIT,
611 client_id_metadata_document_supported: typing.Optional[bool] = OMIT,
612 enable_ai_guide: typing.Optional[bool] = OMIT,
613 phone_consolidated_experience: typing.Optional[bool] = OMIT,
614 include_session_metadata_in_tenant_logs: typing.Optional[bool] = OMIT,
615 dynamic_client_registration_security_mode: typing.Optional[
616 TenantSettingsDynamicClientRegistrationSecurityMode
617 ] = OMIT,
618 country_codes: typing.Optional[TenantSettingsCountryCodes] = OMIT,
619 request_options: typing.Optional[RequestOptions] = None,
620 ) -> AsyncHttpResponse[UpdateTenantSettingsResponseContent]:
621 """
622 Update settings for a tenant.
623
624 Parameters
625 ----------
626 change_password : typing.Optional[TenantSettingsPasswordPage]
627
628 device_flow : typing.Optional[TenantSettingsDeviceFlow]
629 Device Flow configuration.
630
631 guardian_mfa_page : typing.Optional[TenantSettingsGuardianPage]
632
633 default_audience : typing.Optional[str]
634 Default audience for API Authorization.
635
636 default_directory : typing.Optional[str]
637 Name of connection used for password grants at the `/token` endpoint. The following connection types are supported: LDAP, AD, Database Connections, Passwordless, Windows Azure Active Directory, ADFS.
638
639 error_page : typing.Optional[TenantSettingsErrorPage]
640
641 default_token_quota : typing.Optional[DefaultTokenQuota]
642
643 flags : typing.Optional[TenantSettingsFlags]
644
645 friendly_name : typing.Optional[str]
646 Friendly name for this tenant.
647
648 picture_url : typing.Optional[str]
649 URL of logo to be shown for this tenant (recommended size: 150x150)
650
651 support_email : typing.Optional[str]
652 End-user support email.
653
654 support_url : typing.Optional[str]
655 End-user support url.
656
657 allowed_logout_urls : typing.Optional[typing.Sequence[str]]
658 URLs that are valid to redirect to after logout from Auth0.
659
660 session_lifetime : typing.Optional[int]
661 Number of hours a session will stay valid.
662
663 session_lifetime_in_minutes : typing.Optional[int]
664 Number of minutes a session will stay valid. Cannot be specified together with `session_lifetime`.
665
666 idle_session_lifetime : typing.Optional[int]
667 Number of hours for which a session can be inactive before the user must log in again.
668
669 idle_session_lifetime_in_minutes : typing.Optional[int]
670 Number of minutes a session can be inactive before the user must log in again. Cannot be specified together with `idle_session_lifetime`.
671
672 ephemeral_session_lifetime : typing.Optional[int]
673 Number of hours an ephemeral (non-persistent) session will stay valid.
674
675 idle_ephemeral_session_lifetime : typing.Optional[int]
676 Number of hours for which an ephemeral (non-persistent) session can be inactive before the user must log in again.
677
678 ephemeral_session_lifetime_in_minutes : typing.Optional[int]
679 Number of minutes an ephemeral (non-persistent) session will stay valid. Cannot be specified together with `ephemeral_session_lifetime`.
680
681 idle_ephemeral_session_lifetime_in_minutes : typing.Optional[int]
682 Number of minutes an ephemeral (non-persistent) session can be inactive before the user must log in again. Cannot be specified together with `idle_ephemeral_session_lifetime`.
683
684 sandbox_version : typing.Optional[str]
685 Selected sandbox version for the extensibility environment
686
687 legacy_sandbox_version : typing.Optional[str]
688 Selected legacy sandbox version for the extensibility environment
689
690 default_redirection_uri : typing.Optional[str]
691 The default absolute redirection uri, must be https
692
693 enabled_locales : typing.Optional[typing.Sequence[TenantSettingsSupportedLocalesEnum]]
694 Supported locales for the user interface
695
696 security_headers : typing.Optional[TenantSettingsNullableSecurityHeaders]
697
698 session_cookie : typing.Optional[SessionCookieSchema]
699
700 sessions : typing.Optional[TenantSettingsSessions]
701
702 oidc_logout : typing.Optional[TenantOidcLogoutSettings]
703
704 customize_mfa_in_postlogin_action : typing.Optional[bool]
705 Whether to enable flexible factors for MFA in the PostLogin action
706
707 allow_organization_name_in_authentication_api : typing.Optional[bool]
708 Whether to accept an organization name instead of an ID on auth endpoints
709
710 acr_values_supported : typing.Optional[typing.Sequence[str]]
711 Supported ACR values
712
713 mtls : typing.Optional[TenantSettingsMtls]
714
715 pushed_authorization_requests_supported : typing.Optional[bool]
716 Enables the use of Pushed Authorization Requests
717
718 authorization_response_iss_parameter_supported : typing.Optional[bool]
719 Supports iss parameter in authorization responses
720
721 skip_non_verifiable_callback_uri_confirmation_prompt : typing.Optional[bool]
722 Controls whether a confirmation prompt is shown during login flows when the redirect URI uses non-verifiable callback URIs (for example, a custom URI schema such as `myapp://`, or `localhost`).
723 If set to true, a confirmation prompt will not be shown. We recommend that this is set to false for improved protection from malicious apps.
724 See https://auth0.com/docs/secure/security-guidance/measures-against-app-impersonation for more information.
725
726 resource_parameter_profile : typing.Optional[TenantSettingsResourceParameterProfile]
727
728 client_id_metadata_document_supported : typing.Optional[bool]
729 Whether the authorization server supports retrieving client metadata from a client_id URL.
730
731 enable_ai_guide : typing.Optional[bool]
732 Whether Auth0 Guide (AI-powered assistance) is enabled for this tenant.
733
734 phone_consolidated_experience : typing.Optional[bool]
735 Whether Phone Consolidated Experience is enabled for this tenant.
736
737 include_session_metadata_in_tenant_logs : typing.Optional[bool]
738 Whether session metadata is included in specific tenant logs (slo, oidc_backchannel_logout_failed, oidc_backchannel_logout_succeeded).
739
740 dynamic_client_registration_security_mode : typing.Optional[TenantSettingsDynamicClientRegistrationSecurityMode]
741
742 country_codes : typing.Optional[TenantSettingsCountryCodes]
743
744 request_options : typing.Optional[RequestOptions]
745 Request-specific configuration.
746
747 Returns
748 -------
749 AsyncHttpResponse[UpdateTenantSettingsResponseContent]
750 Tenant settings successfully updated.
751 """
752 _response = await self._client_wrapper.httpx_client.request(
753 "tenants/settings",
754 method="PATCH",
755 json={
756 "change_password": convert_and_respect_annotation_metadata(
757 object_=change_password, annotation=typing.Optional[TenantSettingsPasswordPage], direction="write"
758 ),
759 "device_flow": convert_and_respect_annotation_metadata(
760 object_=device_flow, annotation=typing.Optional[TenantSettingsDeviceFlow], direction="write"
761 ),
762 "guardian_mfa_page": convert_and_respect_annotation_metadata(
763 object_=guardian_mfa_page, annotation=typing.Optional[TenantSettingsGuardianPage], direction="write"
764 ),
765 "default_audience": default_audience,
766 "default_directory": default_directory,
767 "error_page": convert_and_respect_annotation_metadata(
768 object_=error_page, annotation=typing.Optional[TenantSettingsErrorPage], direction="write"
769 ),
770 "default_token_quota": convert_and_respect_annotation_metadata(
771 object_=default_token_quota, annotation=typing.Optional[DefaultTokenQuota], direction="write"
772 ),
773 "flags": convert_and_respect_annotation_metadata(
774 object_=flags, annotation=TenantSettingsFlags, direction="write"
775 ),
776 "friendly_name": friendly_name,
777 "picture_url": picture_url,
778 "support_email": support_email,
779 "support_url": support_url,
780 "allowed_logout_urls": allowed_logout_urls,
781 "session_lifetime": session_lifetime,
782 "session_lifetime_in_minutes": session_lifetime_in_minutes,
783 "idle_session_lifetime": idle_session_lifetime,
784 "idle_session_lifetime_in_minutes": idle_session_lifetime_in_minutes,
785 "ephemeral_session_lifetime": ephemeral_session_lifetime,
786 "idle_ephemeral_session_lifetime": idle_ephemeral_session_lifetime,
787 "ephemeral_session_lifetime_in_minutes": ephemeral_session_lifetime_in_minutes,
788 "idle_ephemeral_session_lifetime_in_minutes": idle_ephemeral_session_lifetime_in_minutes,
789 "sandbox_version": sandbox_version,
790 "legacy_sandbox_version": legacy_sandbox_version,
791 "default_redirection_uri": default_redirection_uri,
792 "enabled_locales": enabled_locales,
793 "security_headers": convert_and_respect_annotation_metadata(
794 object_=security_headers,
795 annotation=typing.Optional[TenantSettingsNullableSecurityHeaders],
796 direction="write",
797 ),
798 "session_cookie": convert_and_respect_annotation_metadata(
799 object_=session_cookie, annotation=typing.Optional[SessionCookieSchema], direction="write"
800 ),
801 "sessions": convert_and_respect_annotation_metadata(
802 object_=sessions, annotation=typing.Optional[TenantSettingsSessions], direction="write"
803 ),
804 "oidc_logout": convert_and_respect_annotation_metadata(
805 object_=oidc_logout, annotation=TenantOidcLogoutSettings, direction="write"
806 ),
807 "customize_mfa_in_postlogin_action": customize_mfa_in_postlogin_action,
808 "allow_organization_name_in_authentication_api": allow_organization_name_in_authentication_api,
809 "acr_values_supported": acr_values_supported,
810 "mtls": convert_and_respect_annotation_metadata(
811 object_=mtls, annotation=typing.Optional[TenantSettingsMtls], direction="write"
812 ),
813 "pushed_authorization_requests_supported": pushed_authorization_requests_supported,
814 "authorization_response_iss_parameter_supported": authorization_response_iss_parameter_supported,
815 "skip_non_verifiable_callback_uri_confirmation_prompt": skip_non_verifiable_callback_uri_confirmation_prompt,
816 "resource_parameter_profile": resource_parameter_profile,
817 "client_id_metadata_document_supported": client_id_metadata_document_supported,
818 "enable_ai_guide": enable_ai_guide,
819 "phone_consolidated_experience": phone_consolidated_experience,
820 "include_session_metadata_in_tenant_logs": include_session_metadata_in_tenant_logs,
821 "dynamic_client_registration_security_mode": dynamic_client_registration_security_mode,
822 "country_codes": convert_and_respect_annotation_metadata(
823 object_=country_codes, annotation=typing.Optional[TenantSettingsCountryCodes], direction="write"
824 ),
825 },
826 headers={
827 "content-type": "application/json",
828 },
829 request_options=request_options,
830 omit=OMIT,
831 )
832 try:
833 if 200 <= _response.status_code < 300:
834 _data = typing.cast(
835 UpdateTenantSettingsResponseContent,
836 parse_obj_as(
837 type_=UpdateTenantSettingsResponseContent, # type: ignore
838 object_=_response.json(),
839 ),
840 )
841 return AsyncHttpResponse(response=_response, data=_data)
842 if _response.status_code == 400:
843 raise BadRequestError(
844 headers=dict(_response.headers),
845 body=typing.cast(
846 typing.Any,
847 parse_obj_as(
848 type_=typing.Any, # type: ignore
849 object_=_response.json(),
850 ),
851 ),
852 )
853 if _response.status_code == 401:
854 raise UnauthorizedError(
855 headers=dict(_response.headers),
856 body=typing.cast(
857 typing.Any,
858 parse_obj_as(
859 type_=typing.Any, # type: ignore
860 object_=_response.json(),
861 ),
862 ),
863 )
864 if _response.status_code == 403:
865 raise ForbiddenError(
866 headers=dict(_response.headers),
867 body=typing.cast(
868 typing.Any,
869 parse_obj_as(
870 type_=typing.Any, # type: ignore
871 object_=_response.json(),
872 ),
873 ),
874 )
875 if _response.status_code == 429:
876 raise TooManyRequestsError(
877 headers=dict(_response.headers),
878 body=typing.cast(
879 typing.Any,
880 parse_obj_as(
881 type_=typing.Any, # type: ignore
882 object_=_response.json(),
883 ),
884 ),
885 )
886 _response_json = _response.json()
887 except JSONDecodeError:
888 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
889 except ValidationError as e:
890 raise ParsingError(
891 status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
892 )
893 raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)