Skip to content

Add OPENSHIFT_LOGIN_IDP to skip the IdP chooser page - #2

Merged
joschi36 merged 3 commits into
mainfrom
add-idp-env-var
Sep 9, 2026
Merged

joschi36 merged 3 commits into
mainfrom
add-idp-env-var

Conversation

@joschi36

@joschi36 joschi36 commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

OpenShift's OAuth server shows an identity-provider chooser page before redirecting to the actual IdP whenever the authorize request doesn't specify one. This adds an optional OPENSHIFT_LOGIN_IDP environment variable: when set, its (trimmed) value is passed as the idp query parameter on the authorize request, which skips the chooser and goes straight to that IdP. Leaving it unset keeps the existing chooser behavior — fully backward compatible.

  • main.go: read OPENSHIFT_LOGIN_IDP, append oauth2.SetAuthURLParam("idp", idp) to AuthCodeOptions when set
  • README.md: document the new env var next to OPENSHIFT_LOGIN_LOGLEVEL, with an example kubeconfig entry

Test plan

OpenShift's OAuth server shows an identity-provider chooser page before
redirecting to the actual IdP when the authorize request doesn't specify
one. Setting OPENSHIFT_LOGIN_IDP to a configured IdP name now adds it as
the `idp` query parameter on the authorize request, skipping the chooser.
Unset (default) keeps the existing chooser behavior.

Claude-Session: https://claude.ai/code/session_012VuiD96S6BWQDNCbrKxzM2
Copilot AI lite review requested due to automatic review settings September 9, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Minor but concrete implementation issues (whitespace handling and Go formatting consistency) should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an optional environment-variable override to force OpenShift OAuth to skip the identity-provider chooser by setting the idp query parameter on the authorization request, while preserving existing behavior when unset.

Changes:

  • Read OPENSHIFT_LOGIN_IDP and, when set, append oauth2.SetAuthURLParam("idp", ...) to OAuth2 auth code options.
  • Document OPENSHIFT_LOGIN_IDP usage in the kubeconfig exec env example and in the README “How It Works” section.
File summaries
File Description
README.md Documents the new OPENSHIFT_LOGIN_IDP env var and shows an example kubeconfig entry.
main.go Adds optional idp parameter injection into the OAuth2 authorization request options.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread main.go Resolved
Comment thread main.go Resolved
Addresses Copilot review feedback: a trailing/leading whitespace value
(e.g. from a stray newline in an env file) would otherwise produce an
invalid idp query parameter.

Claude-Session: https://claude.ai/code/session_012VuiD96S6BWQDNCbrKxzM2
@joschi36
joschi36 merged commit 125bf80 into main Sep 9, 2026
@joschi36
joschi36 deleted the add-idp-env-var branch September 9, 2026 14:24
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

⌂ 换网址