Skip to content

Commit 07aa0cc

Browse files
feat(api): add additional_scopes to organization SSO configuration
1 parent 2154cd8 commit 07aa0cc

File tree

9 files changed

+74
-3
lines changed

9 files changed

+74
-3
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 172
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-4e76b45ac7aedb89d725b01fea9f009672c3f3b0117393178e034718095339a3.yml
3-
openapi_spec_hash: 11437695b49cfe5d28bef5d4ee65d696
4-
config_hash: 401f8a117c48e880889ed27a8403db29
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-a6b5c6f4bd34c0b9cbb1321be432905e6120f4479ad2a53d35790f99c2e05b29.yml
3+
openapi_spec_hash: 83b243294469b6646f0c4659566b3f48
4+
config_hash: 73b8de7922813d562151d404149c768d

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ Types:
495495

496496
```python
497497
from gitpod.types.organizations import (
498+
AdditionalScopesUpdate,
498499
ProviderType,
499500
SSOConfiguration,
500501
SSOConfigurationState,

src/gitpod/resources/organizations/sso_configurations.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
)
2929
from ...types.organizations.sso_configuration import SSOConfiguration
3030
from ...types.organizations.sso_configuration_state import SSOConfigurationState
31+
from ...types.organizations.additional_scopes_update_param import AdditionalScopesUpdateParam
3132
from ...types.organizations.sso_configuration_create_response import SSOConfigurationCreateResponse
3233
from ...types.organizations.sso_configuration_retrieve_response import SSOConfigurationRetrieveResponse
3334

@@ -61,6 +62,7 @@ def create(
6162
client_secret: str,
6263
issuer_url: str,
6364
organization_id: str,
65+
additional_scopes: SequenceNotStr[str] | Omit = omit,
6466
display_name: str | Omit = omit,
6567
email_domain: Optional[str] | Omit = omit,
6668
email_domains: SequenceNotStr[str] | Omit = omit,
@@ -114,6 +116,10 @@ def create(
114116
115117
issuer_url: issuer_url is the URL of the IdP issuer
116118
119+
additional_scopes: additional_scopes are extra OIDC scopes to request from the identity provider
120+
during sign-in. These are appended to the default scopes (openid, email,
121+
profile).
122+
117123
email_domain: email_domain is the domain that is allowed to sign in to the organization
118124
119125
extra_headers: Send extra headers
@@ -132,6 +138,7 @@ def create(
132138
"client_secret": client_secret,
133139
"issuer_url": issuer_url,
134140
"organization_id": organization_id,
141+
"additional_scopes": additional_scopes,
135142
"display_name": display_name,
136143
"email_domain": email_domain,
137144
"email_domains": email_domains,
@@ -201,6 +208,7 @@ def update(
201208
self,
202209
*,
203210
sso_configuration_id: str,
211+
additional_scopes: Optional[AdditionalScopesUpdateParam] | Omit = omit,
204212
claims: Dict[str, str] | Omit = omit,
205213
client_id: Optional[str] | Omit = omit,
206214
client_secret: Optional[str] | Omit = omit,
@@ -251,6 +259,10 @@ def update(
251259
Args:
252260
sso_configuration_id: sso_configuration_id is the ID of the SSO configuration to update
253261
262+
additional_scopes: additional_scopes replaces the configured OIDC scopes when present. When absent
263+
(nil), scopes are left unchanged. When present with an empty scopes list, all
264+
additional scopes are cleared.
265+
254266
claims: claims are key/value pairs that defines a mapping of claims issued by the IdP.
255267
256268
client_id: client_id is the client ID of the SSO provider
@@ -274,6 +286,7 @@ def update(
274286
body=maybe_transform(
275287
{
276288
"sso_configuration_id": sso_configuration_id,
289+
"additional_scopes": additional_scopes,
277290
"claims": claims,
278291
"client_id": client_id,
279292
"client_secret": client_secret,
@@ -455,6 +468,7 @@ async def create(
455468
client_secret: str,
456469
issuer_url: str,
457470
organization_id: str,
471+
additional_scopes: SequenceNotStr[str] | Omit = omit,
458472
display_name: str | Omit = omit,
459473
email_domain: Optional[str] | Omit = omit,
460474
email_domains: SequenceNotStr[str] | Omit = omit,
@@ -508,6 +522,10 @@ async def create(
508522
509523
issuer_url: issuer_url is the URL of the IdP issuer
510524
525+
additional_scopes: additional_scopes are extra OIDC scopes to request from the identity provider
526+
during sign-in. These are appended to the default scopes (openid, email,
527+
profile).
528+
511529
email_domain: email_domain is the domain that is allowed to sign in to the organization
512530
513531
extra_headers: Send extra headers
@@ -526,6 +544,7 @@ async def create(
526544
"client_secret": client_secret,
527545
"issuer_url": issuer_url,
528546
"organization_id": organization_id,
547+
"additional_scopes": additional_scopes,
529548
"display_name": display_name,
530549
"email_domain": email_domain,
531550
"email_domains": email_domains,
@@ -595,6 +614,7 @@ async def update(
595614
self,
596615
*,
597616
sso_configuration_id: str,
617+
additional_scopes: Optional[AdditionalScopesUpdateParam] | Omit = omit,
598618
claims: Dict[str, str] | Omit = omit,
599619
client_id: Optional[str] | Omit = omit,
600620
client_secret: Optional[str] | Omit = omit,
@@ -645,6 +665,10 @@ async def update(
645665
Args:
646666
sso_configuration_id: sso_configuration_id is the ID of the SSO configuration to update
647667
668+
additional_scopes: additional_scopes replaces the configured OIDC scopes when present. When absent
669+
(nil), scopes are left unchanged. When present with an empty scopes list, all
670+
additional scopes are cleared.
671+
648672
claims: claims are key/value pairs that defines a mapping of claims issued by the IdP.
649673
650674
client_id: client_id is the client ID of the SSO provider
@@ -668,6 +692,7 @@ async def update(
668692
body=await async_maybe_transform(
669693
{
670694
"sso_configuration_id": sso_configuration_id,
695+
"additional_scopes": additional_scopes,
671696
"claims": claims,
672697
"client_id": client_id,
673698
"client_secret": client_secret,

src/gitpod/types/organizations/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from .custom_domain_retrieve_params import CustomDomainRetrieveParams as CustomDomainRetrieveParams
3535
from .custom_domain_update_response import CustomDomainUpdateResponse as CustomDomainUpdateResponse
3636
from .sso_configuration_list_params import SSOConfigurationListParams as SSOConfigurationListParams
37+
from .additional_scopes_update_param import AdditionalScopesUpdateParam as AdditionalScopesUpdateParam
3738
from .announcement_banner_get_params import AnnouncementBannerGetParams as AnnouncementBannerGetParams
3839
from .scim_configuration_list_params import ScimConfigurationListParams as ScimConfigurationListParams
3940
from .custom_domain_retrieve_response import CustomDomainRetrieveResponse as CustomDomainRetrieveResponse
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
from ..._types import SequenceNotStr
8+
9+
__all__ = ["AdditionalScopesUpdateParam"]
10+
11+
12+
class AdditionalScopesUpdateParam(TypedDict, total=False):
13+
"""
14+
AdditionalScopesUpdate wraps a list of OIDC scopes so that the update request
15+
can distinguish "not changing scopes" (field absent) from "clearing all scopes"
16+
(field present, empty list).
17+
"""
18+
19+
scopes: SequenceNotStr[str]

src/gitpod/types/organizations/sso_configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class SSOConfiguration(BaseModel):
2626
state: SSOConfigurationState
2727
"""state is the state of the SSO configuration"""
2828

29+
additional_scopes: Optional[List[str]] = FieldInfo(alias="additionalScopes", default=None)
30+
"""
31+
additional_scopes are extra OIDC scopes requested from the identity provider
32+
during sign-in.
33+
"""
34+
2935
claims: Optional[Dict[str, str]] = None
3036
"""claims are key/value pairs that defines a mapping of claims issued by the IdP."""
3137

src/gitpod/types/organizations/sso_configuration_create_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ class SSOConfigurationCreateParams(TypedDict, total=False):
2323

2424
organization_id: Required[Annotated[str, PropertyInfo(alias="organizationId")]]
2525

26+
additional_scopes: Annotated[SequenceNotStr[str], PropertyInfo(alias="additionalScopes")]
27+
"""
28+
additional_scopes are extra OIDC scopes to request from the identity provider
29+
during sign-in. These are appended to the default scopes (openid, email,
30+
profile).
31+
"""
32+
2633
display_name: Annotated[str, PropertyInfo(alias="displayName")]
2734

2835
email_domain: Annotated[Optional[str], PropertyInfo(alias="emailDomain")]

src/gitpod/types/organizations/sso_configuration_update_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ..._types import SequenceNotStr
99
from ..._utils import PropertyInfo
1010
from .sso_configuration_state import SSOConfigurationState
11+
from .additional_scopes_update_param import AdditionalScopesUpdateParam
1112

1213
__all__ = ["SSOConfigurationUpdateParams"]
1314

@@ -16,6 +17,13 @@ class SSOConfigurationUpdateParams(TypedDict, total=False):
1617
sso_configuration_id: Required[Annotated[str, PropertyInfo(alias="ssoConfigurationId")]]
1718
"""sso_configuration_id is the ID of the SSO configuration to update"""
1819

20+
additional_scopes: Annotated[Optional[AdditionalScopesUpdateParam], PropertyInfo(alias="additionalScopes")]
21+
"""
22+
additional_scopes replaces the configured OIDC scopes when present. When absent
23+
(nil), scopes are left unchanged. When present with an empty scopes list, all
24+
additional scopes are cleared.
25+
"""
26+
1927
claims: Dict[str, str]
2028
"""claims are key/value pairs that defines a mapping of claims issued by the IdP."""
2129

tests/api_resources/organizations/test_sso_configurations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None:
4141
client_secret="GOCSPX-abcdefghijklmnopqrstuvwxyz123456",
4242
issuer_url="https://accounts.google.com",
4343
organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
44+
additional_scopes=["x"],
4445
display_name="displayName",
4546
email_domain="acme-corp.com",
4647
email_domains=["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"],
@@ -126,6 +127,7 @@ def test_method_update(self, client: Gitpod) -> None:
126127
def test_method_update_with_all_params(self, client: Gitpod) -> None:
127128
sso_configuration = client.organizations.sso_configurations.update(
128129
sso_configuration_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
130+
additional_scopes={"scopes": ["x"]},
129131
claims={"foo": "string"},
130132
client_id="new-client-id",
131133
client_secret="new-client-secret",
@@ -270,6 +272,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) ->
270272
client_secret="GOCSPX-abcdefghijklmnopqrstuvwxyz123456",
271273
issuer_url="https://accounts.google.com",
272274
organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
275+
additional_scopes=["x"],
273276
display_name="displayName",
274277
email_domain="acme-corp.com",
275278
email_domains=["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"],
@@ -355,6 +358,7 @@ async def test_method_update(self, async_client: AsyncGitpod) -> None:
355358
async def test_method_update_with_all_params(self, async_client: AsyncGitpod) -> None:
356359
sso_configuration = await async_client.organizations.sso_configurations.update(
357360
sso_configuration_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
361+
additional_scopes={"scopes": ["x"]},
358362
claims={"foo": "string"},
359363
client_id="new-client-id",
360364
client_secret="new-client-secret",

0 commit comments

Comments
 (0)