Skip to content

Allow specifying clientId together with clientAssertion/clientAssertionType #713

@geovie

Description

@geovie

Currently it's only possible to either specify the clientId or use clientAssertion/clientAssertionType.

However some provider require the use of clientId together with clientAssertion/clientAssertionType
e.g. Microsoft requires a clientId if the certificate credential is used see: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow#request-an-access-token-with-a-certificate-credential
and I think also keycloak requires clientId always to be present:
https://github.com/keycloak/keycloak/blob/5387aef0fa727ea5cae4816f682ec72798fabaa4/services/src/main/java/org/keycloak/protocol/oidc/endpoints/request/AuthorizationEndpointRequestParserProcessor.java#L119-L123

The code responsible for it is in:

String clientId = config.getClientId();
if (clientId == null) {
if (config.getClientAssertionType() != null) {
form
.put("client_assertion_type", config.getClientAssertionType());
}
if (config.getClientAssertion() != null) {
form
.put("client_assertion", config.getClientAssertion());
}
}

I guess this could be relaxed to only check if clientSecret is null and allow both clientId and clientAssertion/clientAssertionType.

Happy to provide a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions