Skip to content

Conversation

@overheadhunter
Copy link
Contributor

@overheadhunter overheadhunter commented Oct 26, 2023

This adds support for the Client Credentials Grant type, allowing utilization of this lib for daemons aka service accounts that authenticate without user interaction.

Implementation details:

  1. In respect to RFC 6749, Section 2.3.1, we use the Basic Authentication Scheme to transmit the client credentials. This is the recommended method and other than using body parameters it MUST be supported by all compliant Authorization Servers.

  2. RFC 7617 amends older standards for Basic Auth in regards of specifying a charset. While UTF-8 is a de-facto standard and a recommended fallback, the encoding of credentials may depend on using the correct charset. So this lib allows specifying a credentials charset.

  3. RFC 6749, Section 6 specifies that authentication is also required during token refresh:

    If the client type is confidential or the client was issued client credentials [...], the client MUST authenticate with the authorization server

    As adhering to this specification is likely to requires an API change, this implementation is currently wilfully violating this specification. Should a token refresh using the Client Credentials Grant type ever be required downstream, we need to add it.

@overheadhunter overheadhunter added the enhancement New feature or request label Oct 26, 2023
Copy link
Member

@SailReal SailReal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me 👍

I'll run some tests and approve it if I don't notice anything.

Copy link
Member

@SailReal SailReal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My local tests against Keycloak were also successful.

@overheadhunter overheadhunter merged commit 7933e64 into develop Oct 27, 2023
@overheadhunter overheadhunter deleted the feature/client-credential branch October 27, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants