Skip to content

Commit d484eb4

Browse files
feat(api): add claims_expression parameter to sso_configurations create and update
1 parent d34b7e5 commit d484eb4

6 files changed

Lines changed: 56 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-1de1f598d14617efe8f8a2034e5eb7bbdc802c6a51585aa90800c45c51097d1d.yml
3-
openapi_spec_hash: 6404715e9e40c26063077beb5fde7f2a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-86397010ee4d38791a16758fd0668c48c3c6c0c552e0aca553e78250eb452f97.yml
3+
openapi_spec_hash: 32003ebf118835677522e0d0166b8200
44
config_hash: 832c76d9cd88fc815f872ad64998911a

src/gitpod/resources/organizations/sso_configurations.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def create(
6363
issuer_url: str,
6464
organization_id: str,
6565
additional_scopes: SequenceNotStr[str] | Omit = omit,
66+
claims_expression: Optional[str] | Omit = omit,
6667
display_name: str | Omit = omit,
6768
email_domain: Optional[str] | Omit = omit,
6869
email_domains: SequenceNotStr[str] | Omit = omit,
@@ -120,6 +121,11 @@ def create(
120121
during sign-in. These are appended to the default scopes (openid, email,
121122
profile).
122123
124+
claims_expression: claims_expression is an optional CEL expression evaluated against OIDC token
125+
claims during login. When set, the expression must evaluate to true for the
126+
login to succeed. Example:
127+
`claims.email_verified && claims.email.endsWith("@example.com")`
128+
123129
email_domain: email_domain is the domain that is allowed to sign in to the organization
124130
125131
extra_headers: Send extra headers
@@ -139,6 +145,7 @@ def create(
139145
"issuer_url": issuer_url,
140146
"organization_id": organization_id,
141147
"additional_scopes": additional_scopes,
148+
"claims_expression": claims_expression,
142149
"display_name": display_name,
143150
"email_domain": email_domain,
144151
"email_domains": email_domains,
@@ -210,6 +217,7 @@ def update(
210217
sso_configuration_id: str,
211218
additional_scopes: Optional[AdditionalScopesUpdateParam] | Omit = omit,
212219
claims: Dict[str, str] | Omit = omit,
220+
claims_expression: Optional[str] | Omit = omit,
213221
client_id: Optional[str] | Omit = omit,
214222
client_secret: Optional[str] | Omit = omit,
215223
display_name: Optional[str] | Omit = omit,
@@ -265,6 +273,10 @@ def update(
265273
266274
claims: claims are key/value pairs that defines a mapping of claims issued by the IdP.
267275
276+
claims_expression: claims_expression is a CEL expression evaluated against OIDC token claims during
277+
login. When set, the expression must evaluate to true for the login to succeed.
278+
When present with an empty string, the expression is cleared.
279+
268280
client_id: client_id is the client ID of the SSO provider
269281
270282
client_secret: client_secret is the client secret of the SSO provider
@@ -288,6 +300,7 @@ def update(
288300
"sso_configuration_id": sso_configuration_id,
289301
"additional_scopes": additional_scopes,
290302
"claims": claims,
303+
"claims_expression": claims_expression,
291304
"client_id": client_id,
292305
"client_secret": client_secret,
293306
"display_name": display_name,
@@ -469,6 +482,7 @@ async def create(
469482
issuer_url: str,
470483
organization_id: str,
471484
additional_scopes: SequenceNotStr[str] | Omit = omit,
485+
claims_expression: Optional[str] | Omit = omit,
472486
display_name: str | Omit = omit,
473487
email_domain: Optional[str] | Omit = omit,
474488
email_domains: SequenceNotStr[str] | Omit = omit,
@@ -526,6 +540,11 @@ async def create(
526540
during sign-in. These are appended to the default scopes (openid, email,
527541
profile).
528542
543+
claims_expression: claims_expression is an optional CEL expression evaluated against OIDC token
544+
claims during login. When set, the expression must evaluate to true for the
545+
login to succeed. Example:
546+
`claims.email_verified && claims.email.endsWith("@example.com")`
547+
529548
email_domain: email_domain is the domain that is allowed to sign in to the organization
530549
531550
extra_headers: Send extra headers
@@ -545,6 +564,7 @@ async def create(
545564
"issuer_url": issuer_url,
546565
"organization_id": organization_id,
547566
"additional_scopes": additional_scopes,
567+
"claims_expression": claims_expression,
548568
"display_name": display_name,
549569
"email_domain": email_domain,
550570
"email_domains": email_domains,
@@ -616,6 +636,7 @@ async def update(
616636
sso_configuration_id: str,
617637
additional_scopes: Optional[AdditionalScopesUpdateParam] | Omit = omit,
618638
claims: Dict[str, str] | Omit = omit,
639+
claims_expression: Optional[str] | Omit = omit,
619640
client_id: Optional[str] | Omit = omit,
620641
client_secret: Optional[str] | Omit = omit,
621642
display_name: Optional[str] | Omit = omit,
@@ -671,6 +692,10 @@ async def update(
671692
672693
claims: claims are key/value pairs that defines a mapping of claims issued by the IdP.
673694
695+
claims_expression: claims_expression is a CEL expression evaluated against OIDC token claims during
696+
login. When set, the expression must evaluate to true for the login to succeed.
697+
When present with an empty string, the expression is cleared.
698+
674699
client_id: client_id is the client ID of the SSO provider
675700
676701
client_secret: client_secret is the client secret of the SSO provider
@@ -694,6 +719,7 @@ async def update(
694719
"sso_configuration_id": sso_configuration_id,
695720
"additional_scopes": additional_scopes,
696721
"claims": claims,
722+
"claims_expression": claims_expression,
697723
"client_id": client_id,
698724
"client_secret": client_secret,
699725
"display_name": display_name,

src/gitpod/types/organizations/sso_configuration.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class SSOConfiguration(BaseModel):
3535
claims: Optional[Dict[str, str]] = None
3636
"""claims are key/value pairs that defines a mapping of claims issued by the IdP."""
3737

38+
claims_expression: Optional[str] = FieldInfo(alias="claimsExpression", default=None)
39+
"""
40+
claims_expression is a CEL (Common Expression Language) expression evaluated
41+
against the OIDC token claims during login. When set, the expression must
42+
evaluate to true for the login to succeed. The expression has access to a
43+
`claims` variable containing all token claims as a map. Example:
44+
`claims.email_verified && claims.email.endsWith("@example.com")`
45+
"""
46+
3847
client_id: Optional[str] = FieldInfo(alias="clientId", default=None)
3948
"""client_id is the client ID of the OIDC application set on the IdP"""
4049

src/gitpod/types/organizations/sso_configuration_create_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ class SSOConfigurationCreateParams(TypedDict, total=False):
3030
profile).
3131
"""
3232

33+
claims_expression: Annotated[Optional[str], PropertyInfo(alias="claimsExpression")]
34+
"""
35+
claims_expression is an optional CEL expression evaluated against OIDC token
36+
claims during login. When set, the expression must evaluate to true for the
37+
login to succeed. Example:
38+
`claims.email_verified && claims.email.endsWith("@example.com")`
39+
"""
40+
3341
display_name: Annotated[str, PropertyInfo(alias="displayName")]
3442

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

src/gitpod/types/organizations/sso_configuration_update_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ class SSOConfigurationUpdateParams(TypedDict, total=False):
2727
claims: Dict[str, str]
2828
"""claims are key/value pairs that defines a mapping of claims issued by the IdP."""
2929

30+
claims_expression: Annotated[Optional[str], PropertyInfo(alias="claimsExpression")]
31+
"""
32+
claims_expression is a CEL expression evaluated against OIDC token claims during
33+
login. When set, the expression must evaluate to true for the login to succeed.
34+
When present with an empty string, the expression is cleared.
35+
"""
36+
3037
client_id: Annotated[Optional[str], PropertyInfo(alias="clientId")]
3138
"""client_id is the client ID of the SSO provider"""
3239

tests/api_resources/organizations/test_sso_configurations.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None:
4242
issuer_url="https://accounts.google.com",
4343
organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
4444
additional_scopes=["x"],
45+
claims_expression="claimsExpression",
4546
display_name="displayName",
4647
email_domain="acme-corp.com",
4748
email_domains=["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"],
@@ -129,6 +130,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None:
129130
sso_configuration_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
130131
additional_scopes={"scopes": ["x"]},
131132
claims={"foo": "string"},
133+
claims_expression="claimsExpression",
132134
client_id="new-client-id",
133135
client_secret="new-client-secret",
134136
display_name="displayName",
@@ -273,6 +275,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) ->
273275
issuer_url="https://accounts.google.com",
274276
organization_id="b0e12f6c-4c67-429d-a4a6-d9838b5da047",
275277
additional_scopes=["x"],
278+
claims_expression="claimsExpression",
276279
display_name="displayName",
277280
email_domain="acme-corp.com",
278281
email_domains=["sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"],
@@ -360,6 +363,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) ->
360363
sso_configuration_id="d2c94c27-3b76-4a42-b88c-95a85e392c68",
361364
additional_scopes={"scopes": ["x"]},
362365
claims={"foo": "string"},
366+
claims_expression="claimsExpression",
363367
client_id="new-client-id",
364368
client_secret="new-client-secret",
365369
display_name="displayName",

0 commit comments

Comments
 (0)