Skip to content

Commit dd840f2

Browse files
committed
Add support for Standard Token Exchange configuration in OpenID Clients
Introduced StandardTokenExchangeEnabled field to OpenidClientAttributes struct. Updated ValidateOpenidClient to enforce that standard token exchange cannot be enabled on public clients. This enhancement enables managing the Standard Token Exchange setting for OpenID Clients through the Keycloak Terraform provider. Signed-off-by: Sven-Torben Janus <[email protected]>
1 parent 34c8db9 commit dd840f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

keycloak/openid_client.go

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type OpenidClientAttributes struct {
8383
Oauth2DeviceCodeLifespan string `json:"oauth2.device.code.lifespan,omitempty"`
8484
Oauth2DevicePollingInterval string `json:"oauth2.device.polling.interval,omitempty"`
8585
PostLogoutRedirectUris types.KeycloakSliceHashDelimited `json:"post.logout.redirect.uris,omitempty"`
86+
StandardTokenExchangeEnabled types.KeycloakBoolQuoted `json:"standard.token.exchange.enabled,omitempty"`
8687
}
8788

8889
type OpenidAuthenticationFlowBindingOverrides struct {
@@ -125,6 +126,10 @@ func (keycloakClient *KeycloakClient) ValidateOpenidClient(ctx context.Context,
125126
return fmt.Errorf("validation error: theme \"%s\" does not exist on the server", client.Attributes.LoginTheme)
126127
}
127128

129+
if client.Attributes.StandardTokenExchangeEnabled == true && client.PublicClient {
130+
return fmt.Errorf("validation error: standard token exchange cannot be enabled on public clients")
131+
}
132+
128133
return nil
129134
}
130135

0 commit comments

Comments
 (0)