|
8 | 8 |
|
9 | 9 | from typing import Any, Dict, List, Optional, Union |
10 | 10 |
|
11 | | -from stytch.b2b.models.discovery_organizations import CreateResponse, ListResponse |
| 11 | +from stytch.b2b.models.discovery_organizations import ( |
| 12 | + CreateRequestFirstPartyConnectedAppsAllowedType, |
| 13 | + CreateRequestThirdPartyConnectedAppsAllowedType, |
| 14 | + CreateResponse, |
| 15 | + ListResponse, |
| 16 | +) |
12 | 17 | from stytch.b2b.models.organizations import EmailImplicitRoleAssignment |
13 | 18 | from stytch.core.api_base import ApiBase |
14 | 19 | from stytch.core.http.client import AsyncClient, SyncClient |
@@ -45,6 +50,14 @@ def create( |
45 | 50 | allowed_mfa_methods: Optional[List[str]] = None, |
46 | 51 | oauth_tenant_jit_provisioning: Optional[str] = None, |
47 | 52 | allowed_oauth_tenants: Optional[Dict[str, Any]] = None, |
| 53 | + first_party_connected_apps_allowed_type: Optional[ |
| 54 | + Union[CreateRequestFirstPartyConnectedAppsAllowedType, str] |
| 55 | + ] = None, |
| 56 | + allowed_first_party_connected_apps: Optional[List[str]] = None, |
| 57 | + third_party_connected_apps_allowed_type: Optional[ |
| 58 | + Union[CreateRequestThirdPartyConnectedAppsAllowedType, str] |
| 59 | + ] = None, |
| 60 | + allowed_third_party_connected_apps: Optional[List[str]] = None, |
48 | 61 | ) -> CreateResponse: |
49 | 62 | """This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a authentication flow to create a new |
50 | 63 | [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object) and log the user in. If the user wants to log into an existing Organization, use the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) instead. |
@@ -143,6 +156,24 @@ def create( |
143 | 156 | `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant. |
144 | 157 |
|
145 | 158 | - allowed_oauth_tenants: A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github". |
| 159 | + - first_party_connected_apps_allowed_type: The authentication setting that sets the Organization's policy towards first party Connected Apps. The accepted values are: |
| 160 | +
|
| 161 | + `ALL_ALLOWED` – any first party Connected App in the Project is permitted for use by Members. |
| 162 | +
|
| 163 | + `RESTRICTED` – only first party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members. |
| 164 | +
|
| 165 | + `NOT_ALLOWED` – no first party Connected Apps are permitted. |
| 166 | +
|
| 167 | + - allowed_first_party_connected_apps: An array of first party Connected App IDs that are allowed for the Organization. Only used when the Organization's `first_party_connected_apps_allowed_type` is `RESTRICTED`. |
| 168 | + - third_party_connected_apps_allowed_type: The authentication setting that sets the Organization's policy towards third party Connected Apps. The accepted values are: |
| 169 | +
|
| 170 | + `ALL_ALLOWED` – any third party Connected App in the Project is permitted for use by Members. |
| 171 | +
|
| 172 | + `RESTRICTED` – only third party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members. |
| 173 | +
|
| 174 | + `NOT_ALLOWED` – no third party Connected Apps are permitted. |
| 175 | +
|
| 176 | + - allowed_third_party_connected_apps: An array of third party Connected App IDs that are allowed for the Organization. Only used when the Organization's `third_party_connected_apps_allowed_type` is `RESTRICTED`. |
146 | 177 | """ # noqa |
147 | 178 | headers: Dict[str, str] = {} |
148 | 179 | data: Dict[str, Any] = { |
@@ -187,6 +218,22 @@ def create( |
187 | 218 | data["oauth_tenant_jit_provisioning"] = oauth_tenant_jit_provisioning |
188 | 219 | if allowed_oauth_tenants is not None: |
189 | 220 | data["allowed_oauth_tenants"] = allowed_oauth_tenants |
| 221 | + if first_party_connected_apps_allowed_type is not None: |
| 222 | + data["first_party_connected_apps_allowed_type"] = ( |
| 223 | + first_party_connected_apps_allowed_type |
| 224 | + ) |
| 225 | + if allowed_first_party_connected_apps is not None: |
| 226 | + data["allowed_first_party_connected_apps"] = ( |
| 227 | + allowed_first_party_connected_apps |
| 228 | + ) |
| 229 | + if third_party_connected_apps_allowed_type is not None: |
| 230 | + data["third_party_connected_apps_allowed_type"] = ( |
| 231 | + third_party_connected_apps_allowed_type |
| 232 | + ) |
| 233 | + if allowed_third_party_connected_apps is not None: |
| 234 | + data["allowed_third_party_connected_apps"] = ( |
| 235 | + allowed_third_party_connected_apps |
| 236 | + ) |
190 | 237 |
|
191 | 238 | url = self.api_base.url_for("/v1/b2b/discovery/organizations/create", data) |
192 | 239 | res = self.sync_client.post(url, data, headers) |
@@ -215,6 +262,14 @@ async def create_async( |
215 | 262 | allowed_mfa_methods: Optional[List[str]] = None, |
216 | 263 | oauth_tenant_jit_provisioning: Optional[str] = None, |
217 | 264 | allowed_oauth_tenants: Optional[Dict[str, Any]] = None, |
| 265 | + first_party_connected_apps_allowed_type: Optional[ |
| 266 | + CreateRequestFirstPartyConnectedAppsAllowedType |
| 267 | + ] = None, |
| 268 | + allowed_first_party_connected_apps: Optional[List[str]] = None, |
| 269 | + third_party_connected_apps_allowed_type: Optional[ |
| 270 | + CreateRequestThirdPartyConnectedAppsAllowedType |
| 271 | + ] = None, |
| 272 | + allowed_third_party_connected_apps: Optional[List[str]] = None, |
218 | 273 | ) -> CreateResponse: |
219 | 274 | """This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a authentication flow to create a new |
220 | 275 | [Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object) and log the user in. If the user wants to log into an existing Organization, use the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) instead. |
@@ -313,6 +368,24 @@ async def create_async( |
313 | 368 | `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant. |
314 | 369 |
|
315 | 370 | - allowed_oauth_tenants: A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github". |
| 371 | + - first_party_connected_apps_allowed_type: The authentication setting that sets the Organization's policy towards first party Connected Apps. The accepted values are: |
| 372 | +
|
| 373 | + `ALL_ALLOWED` – any first party Connected App in the Project is permitted for use by Members. |
| 374 | +
|
| 375 | + `RESTRICTED` – only first party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members. |
| 376 | +
|
| 377 | + `NOT_ALLOWED` – no first party Connected Apps are permitted. |
| 378 | +
|
| 379 | + - allowed_first_party_connected_apps: An array of first party Connected App IDs that are allowed for the Organization. Only used when the Organization's `first_party_connected_apps_allowed_type` is `RESTRICTED`. |
| 380 | + - third_party_connected_apps_allowed_type: The authentication setting that sets the Organization's policy towards third party Connected Apps. The accepted values are: |
| 381 | +
|
| 382 | + `ALL_ALLOWED` – any third party Connected App in the Project is permitted for use by Members. |
| 383 | +
|
| 384 | + `RESTRICTED` – only third party Connected Apps with IDs in `allowed_first_party_connected_apps` can be used by Members. |
| 385 | +
|
| 386 | + `NOT_ALLOWED` – no third party Connected Apps are permitted. |
| 387 | +
|
| 388 | + - allowed_third_party_connected_apps: An array of third party Connected App IDs that are allowed for the Organization. Only used when the Organization's `third_party_connected_apps_allowed_type` is `RESTRICTED`. |
316 | 389 | """ # noqa |
317 | 390 | headers: Dict[str, str] = {} |
318 | 391 | data: Dict[str, Any] = { |
@@ -357,6 +430,22 @@ async def create_async( |
357 | 430 | data["oauth_tenant_jit_provisioning"] = oauth_tenant_jit_provisioning |
358 | 431 | if allowed_oauth_tenants is not None: |
359 | 432 | data["allowed_oauth_tenants"] = allowed_oauth_tenants |
| 433 | + if first_party_connected_apps_allowed_type is not None: |
| 434 | + data["first_party_connected_apps_allowed_type"] = ( |
| 435 | + first_party_connected_apps_allowed_type |
| 436 | + ) |
| 437 | + if allowed_first_party_connected_apps is not None: |
| 438 | + data["allowed_first_party_connected_apps"] = ( |
| 439 | + allowed_first_party_connected_apps |
| 440 | + ) |
| 441 | + if third_party_connected_apps_allowed_type is not None: |
| 442 | + data["third_party_connected_apps_allowed_type"] = ( |
| 443 | + third_party_connected_apps_allowed_type |
| 444 | + ) |
| 445 | + if allowed_third_party_connected_apps is not None: |
| 446 | + data["allowed_third_party_connected_apps"] = ( |
| 447 | + allowed_third_party_connected_apps |
| 448 | + ) |
360 | 449 |
|
361 | 450 | url = self.api_base.url_for("/v1/b2b/discovery/organizations/create", data) |
362 | 451 | res = await self.async_client.post(url, data, headers) |
|
0 commit comments