Skip to content

Add support for Standard Token Exchange configuration in OpenID Clients #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions keycloak/openid_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type OpenidClientAttributes struct {
Oauth2DeviceCodeLifespan string `json:"oauth2.device.code.lifespan,omitempty"`
Oauth2DevicePollingInterval string `json:"oauth2.device.polling.interval,omitempty"`
PostLogoutRedirectUris types.KeycloakSliceHashDelimited `json:"post.logout.redirect.uris,omitempty"`
StandardTokenExchangeEnabled types.KeycloakBoolQuoted `json:"standard.token.exchange.enabled,omitempty"`
}

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

if client.Attributes.StandardTokenExchangeEnabled == true && client.PublicClient {
return fmt.Errorf("validation error: standard token exchange cannot be enabled on public clients")
}

return nil
}

Expand Down
Loading