Skip to content

Allow to hide client scopes from scopes_supported in discovery endpoint #10388

Description

@cgeorgilakis

Description

Keycloak need to be extended in order to be able to hide client scopes from discovery( OpenID Provider Metadata).

We propose to add ClientScopeAttributeEntity with name hideFromOpenIDProviderMetadata (label = Hide from OpenID Provider Metadata) with default value as false. If this value become true, this scope will not listed in OpenID Provider Metadata.

Finally, with this implementation no change is needed during migration.

Discussion

No response

Motivation

According to https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata:

The server MUST support the openid scope value. Servers MAY choose not to advertise some supported scope values even when this parameter is used, although those defined in OpenID.Core SHOULD be listed, if supported.

Details

No response

Activity

  1. remcojansen commented on Oct 22, 2025

    @remcojansen

    In our project we have a similar requirement and I am keen on helping to complete this feature. That said, we are migrating from a different product in which scopes are classified in two categories:

    1. scopes that are available by default to all clients and advertised in the discovery document and
    2. scopes that are available only to clients when explicitly assigned and not advertised in the discovery document.

    This seems similar to how scopes can be assigned on realm level versus client level in Keycloak.

    With this in mind, I would prefer to also (or instead) have the option of hiding all scopes that are only assigned on client level (i.e. where type == none on realm level) from the discovery document. Wdyt?

  2. cgeorgilakis commented on Oct 22, 2025

    @cgeorgilakis
    ContributorAuthor

    In our project we have a similar requirement and I am keen on helping to complete this feature. That said, we are migrating from a different product in which scopes are classified in two categories:

    1. scopes that are available by default to all clients and advertised in the discovery document and
    2. scopes that are available only to clients when explicitly assigned and not advertised in the discovery document.

    This seems similar to how scopes can be assigned on realm level versus client level in Keycloak.

    With this in mind, I would prefer to also (or instead) have the option of hiding all scopes that are only assigned on client level (i.e. where type == none on realm level) from the discovery document. Wdyt?

    Do not confuse settings. type == none is for not being default scope in new creating clients.
    I have proposed hideFromOpenIDProviderMetadata field for this.
    My PR needs to be rebased and opened again. @remcojansen @manusa

  3. manusa commented on Oct 22, 2025

    @manusa
    Contributor

    For more context, this is currently required to make kubernetes-mcp-server work with VSCode and DCR.

    The solution we have at the moment is to overwrite the response when proxying the request to the keycloak server:

    https://github.com/containers/kubernetes-mcp-server/blob/49afbad502e5d97248f3c0d4b7b324311a91d021/pkg/http/wellknown.go#L71-L77

  4. 10 remaining items

  5. added a commit that references this issue on Nov 3, 2025
    ab35b09
  6. self-assigned this
    on Nov 3, 2025
  7. added a commit that references this issue on Nov 4, 2025
    d8055ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Fields

Value

None yet

Effort

None yet

Votes

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions