Skip to content

feat(oauth): expose clientId in OAuthAuthenticatorDescriptor - #1035

Open
olexii4 wants to merge 1 commit into
mainfrom
CRW-11582-device-auth-client-id
Open

feat(oauth): expose clientId in OAuthAuthenticatorDescriptor#1035
olexii4 wants to merge 1 commit into
mainfrom
CRW-11582-device-auth-client-id

Conversation

@olexii4

@olexii4 olexii4 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds clientId to the OAuthAuthenticatorDescriptor DTO returned by GET /api/oauth, so clients can initiate OAuth flows that require the client ID directly — specifically the GitHub Device Authorization Flow (RFC 8628).

Changes

  • OAuthAuthenticatorDescriptor — new clientId field (getter / setter / builder)
  • OAuthAuthenticator — stores the clientId passed to configure() and exposes it via getClientId()
  • EmbeddedOAuthAPI — populates clientId in the descriptor returned by GET /api/oauth

Why

The Che Dashboard's Device Auth Tokens tab (che-dashboard#1633) needs to call GitHub's device flow API directly, which requires the OAuth App client ID. Currently there is no way for the dashboard to obtain this value without:

  • An env var injected by the operator (breaks when using a custom deployment spec for testing)
  • Direct K8s Secret access (requires RBAC changes)

With this change, the dashboard calls GET /api/oauth with its service account token — the same call it already makes for the Git Services tab — and receives the client ID in the response. No additional RBAC, env vars, or volume mounts needed.

Backward compatibility

The new clientId field is optional in the DTO. Existing consumers of GET /api/oauth that don't use clientId are unaffected. OAuth1 providers (where authenticator.getClientId() would return null) simply omit the field.

What issues does this PR fix or reference?

references https://redhat.atlassian.net/browse/CRW-11582

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: olexii4

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tolusha

tolusha commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm che-ai-assistant — I help with your pull requests.

Available commands:

  • /che-ai-assistant generate-che-doc — Generate a documentation PR based on this PR's changes
  • /che-ai-assistant ok-pr-review — Run a comprehensive PR review (summary, code review, deep review, impact analysis)
  • /che-ai-assistant check-pr-test-failures — Analyze failing CI checks, identify root causes, and suggest fixes
  • /che-ai-assistant update-che-e2e-tests — Update Eclipse Che e2e tests
  • /che-ai-assistant claude — Run a free-form instruction on this PR
  • /che-ai-assistant help — Show this help message

@olexii4

olexii4 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/che-ai-assistant ok-pr-review

Task completed.

@olexii4

olexii4 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@olexii4
olexii4 force-pushed the CRW-11582-device-auth-client-id branch 2 times, most recently from 089d0e1 to e9f6223 Compare July 24, 2026 20:25

@tolusha tolusha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test Coverage

The PR adds new API surface in three files but includes no test additions or updates. The existing shouldGetRegisteredAuthenticators test in EmbeddedOAuthAPITest only checks the result-set size, not the descriptor contents. Consider adding tests for:

  • OAuthAuthenticator.getClientId() returns the value passed to configure()
  • EmbeddedOAuthAPI.getRegisteredAuthenticators() sets clientId for OAuth2 providers and null for OAuth1 providers
  • DTO serialization round-trips the clientId field correctly

@github-actions

Copy link
Copy Markdown

Docker image build succeeded: quay.io/eclipse/che-server:pr-1035

kubectl patch command
kubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/cheServer/deployment", "value": {containers: [{image: "quay.io/eclipse/che-server:pr-1035", name: che}]}}]"

@olexii4
olexii4 force-pushed the CRW-11582-device-auth-client-id branch from e9f6223 to 00d1ce2 Compare July 25, 2026 01:43
Add clientId field to OAuthAuthenticatorDescriptor DTO so clients
can initiate OAuth flows that require the client ID directly (e.g.
GitHub Device Authorization Flow / RFC 8628) without needing access
to the raw Kubernetes Secret.

- OAuthAuthenticator: store clientId passed to configure() and
  expose it via getClientId()
- EmbeddedOAuthAPI: populate clientId in the descriptor returned by
  GET /api/oauth
- OAuthAuthenticatorDescriptor: new clientId getter/setter/builder

Signed-off-by: Oleksii Orel <oorel@redhat.com>
@olexii4
olexii4 force-pushed the CRW-11582-device-auth-client-id branch from 00d1ce2 to cb5afc8 Compare July 25, 2026 15:56
@github-actions

Copy link
Copy Markdown

Docker image build succeeded: quay.io/eclipse/che-server:pr-1035

kubectl patch command
kubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/cheServer/deployment", "value": {containers: [{image: "quay.io/eclipse/che-server:pr-1035", name: che}]}}]"

@olexii4

olexii4 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@olexii4

olexii4 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

/che-ai-assistant ok-pr-review

@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown

@olexii4: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v19-bitbucket-no-pat-oauth-flow-ssh-url cb5afc8 link true /test v19-bitbucket-no-pat-oauth-flow-ssh-url

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

2 participants