Skip to content
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

feat: Introducing client_credentials grant | PKCE challenge to the authorization code flow #3162

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

orange-hbenmabrouk
Copy link

@orange-hbenmabrouk orange-hbenmabrouk commented Oct 19, 2023

Overview

This pull request:

  • Introduces the "Client Credentials" flow to the list of supported grant types.
  • Adding an optional field to the oidc connector config in order to introduce a PKCE challenge to the code exchange flow (since some identity providers requires it)

What this PR does / why we need it

  • If a client wants to use Dex with client credentials grant type for machine to machine use cases, they are not able to. So the addition of the client credentials flow would be valuable.

  • If an external IdP is requiring a PKCE challenge when authenticating an authorization_code, the only choice available is to provide it with required information (code_challenge & code_challenge_method as URL params), otherwise the request won't be successful.
    => The addition of the "pkce" parameter to the config of the oidc connector, enables the client to achieve this authentication with the challenge set:

code_challenge & code_challenge_method are set to the authentication endpoint of the external issuer
code_verifier set to the token endpoint of the external issuer

Does this PR introduce a user-facing change?

If
  1. you are using the device authorization flow with an oidc connector
  2. want to authenticate to the external IdP and exchange the access_token using a PKCE challenge
you have to add the "pkce" entry to your connector's config (it's the only action required)

Example:
  connectors:
  - id: my-oidc
    name: My Connector
    type: oidc
    config:
      issuer: https://example-external-issuer.com
      redirectURI: https://example-dex-server.com/callback
      clientID: ***
      clientSecret: ""
      pkce:
        enabled: true # false by default

@orange-hbenmabrouk orange-hbenmabrouk changed the title Implement client credentials grant Introducing client_credentials grant + PKCE challenge to the authorization code flow + Fix to the redirection URI on device authorization flow Oct 19, 2023
@orange-hbenmabrouk orange-hbenmabrouk changed the title Introducing client_credentials grant + PKCE challenge to the authorization code flow + Fix to the redirection URI on device authorization flow Introducing client_credentials grant | PKCE challenge to the authorization code flow | Fix to the redirection URI on device authorization flow Oct 19, 2023
@nabokihms nabokihms self-requested a review October 19, 2023 21:03
@p-kimberley
Copy link

+1 for this - highly desirable for our use case

@p-kimberley
Copy link

Hi @nabokihms could you please review this when you get a chance? This is a blocker for our application and we'd appreciate if this PR could be assessed.

@orange-hbenmabrouk orange-hbenmabrouk force-pushed the implement_client_credentials_grant branch 2 times, most recently from b8f5b1d to e0cd768 Compare November 17, 2023 21:30
@orange-hbenmabrouk orange-hbenmabrouk changed the title Introducing client_credentials grant | PKCE challenge to the authorization code flow | Fix to the redirection URI on device authorization flow feat: Introducing client_credentials grant | PKCE challenge to the authorization code flow Nov 20, 2023
Signed-off-by: Houssem Ben Mabrouk <houssem.benmabrouk.ext@orange.com>
Signed-off-by: Houssem Ben Mabrouk <houssem.benmabrouk.ext@orange.com>
Signed-off-by: Houssem Ben Mabrouk <houssem.benmabrouk.ext@orange.com>
This reverts commit e0cd768.

Signed-off-by: Houssem Ben Mabrouk <houssem.benmabrouk.ext@orange.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants