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

WRKLDS-875: Add oc login external OIDC issuer integration enhancement #1596

Merged

Conversation

ardaguclu
Copy link
Member

This PR reflects the work has been done to enable oc login supporting external OIDC issuers.
Main motivation behind this PR is to store the historical context of analysis about the changes and
elaborate the reasons for future readers.

PRs have merged in oc;

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 14, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 14, 2024

@ardaguclu: This pull request references WRKLDS-875 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.16.0" version, but no target version was set.

In response to this:

This PR reflects the work has been done to enable oc login supporting external OIDC issuers.
Main motivation behind this PR is to store the historical context of analysis about the changes and
elaborate the reasons for future readers.

PRs have merged in oc;

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from jwmatthews and stlaz March 14, 2024 07:30
@ardaguclu ardaguclu force-pushed the oc-login-external-oidc branch 2 times, most recently from 2991f31 to 5c34ae6 Compare March 14, 2024 07:39
| | Authorization Code<br/>(public/confidential) | Authorization Code + PKCE<br/>(public/confidential) | Implicit Flow<br/>(public) | Client Credentials<br/>(confidential) | Refresh Token<br/>(public/confidential) | Device Code<br/>(public) | Password Grant<br/>(confidential) |
|-----------|---------------------------------------------------------------------|---------------------------------------------------------------------|----------------------------|--------------------------------------------------------------------------|-----------------------------------------|--------------------------|-----------------------------------|
| Supported | Yes | Yes | No | No | Yes | No | No |
| Comment | Can be used for confidential clients<br/>by passing --client-secret | Can be used for confidential clients<br/>by passing --client-secret | Deprecated | Mostly used in CI systems that <br/>client-secret can be stored securely | If provider supports it | | Deprecated |
Copy link
Contributor

Choose a reason for hiding this comment

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

for the "can be used for confidential clients" cases, is the confidentiality (or not) controlled by the external OIDC provider configuration? if so, let's add a * and explicitly explain that. It's also worth a look for whether say Entra and Keycloak support both public and confidential clients.

I'd also like to see a row for "it just works from the console copy command".

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.


Supportability (in terms of authentication flows) matrix of this feature is outlined below;

| | Authorization Code<br/>(public/confidential) | Authorization Code + PKCE<br/>(public/confidential) | Implicit Flow<br/>(public) | Client Credentials<br/>(confidential) | Refresh Token<br/>(public/confidential) | Device Code<br/>(public) | Password Grant<br/>(confidential) |
Copy link
Contributor

Choose a reason for hiding this comment

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

If the "it just works for the console" row will vary based on public or confidential (I bet it will), let's separate the public/confidential into two differnet columns.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it will vary based on public or confidential. Separated.

enhancements/oc/oc-login-external-oidc-integration.md Outdated Show resolved Hide resolved
enhancements/oc/oc-login-external-oidc-integration.md Outdated Show resolved Hide resolved
enhancements/oc/oc-login-external-oidc-integration.md Outdated Show resolved Hide resolved
Comment on lines +102 to +103
Moreover, `oc login` command triggers authentication process by sending a request to Project API's whoami endpoint automatically so that
client-go talks to `oc get-token` command to obtain id token (and also refresh token, if provider supports it).
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I fully understand. Project API doesn't have a whoami endpoint?

Are you trying to say that as a part of the login process with oc login, a request is being sent already to the Project API, which in turn triggers the exec credential plugin?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you trying to say that as a part of the login process with oc login, a request is being sent already to the Project API, which in turn triggers the exec credential plugin?

yes

client-go talks to `oc get-token` command to obtain id token (and also refresh token, if provider supports it).

There are currently 7 authentication flows grouped around public and confidential clients. Due to the nature of `oc` that is being used widely on local,
we have decided to support authentication flows only for public clients for now but if there is any different use case in the future, this command can support confidential clients too.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we expose the --client-secret flag above, then?

Copy link
Member Author

Choose a reason for hiding this comment

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

In case cluster (or system) administrator may want to use Auth Code with client-secret.

Copy link
Contributor

Choose a reason for hiding this comment

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

But that's going against the claim here

we have decided to support authentication flows only for public clients for now

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, good point, you are right, let me change it

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed that "only supports public clients" statements altogether because it is not correct.

enhancements/oc/oc-login-external-oidc-integration.md Outdated Show resolved Hide resolved
enhancements/oc/oc-login-external-oidc-integration.md Outdated Show resolved Hide resolved
| | Authorization Code<br/>(public) | Authorization Code<br/>(confidential) | Authorization Code + PKCE<br/>(public) | Authorization Code + PKCE<br/>(confidential) | Implicit Flow<br/>(public) | Client Credentials<br/>(confidential) | Refresh Token<br/>(public/confidential) | Device Code<br/>(public) | Password Grant<br/>(confidential) |
|-----------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|----------------------------|--------------------------------------------------------------------------|-----------------------------------------|--------------------------|-----------------------------------|
| Supported | Yes | Yes | Yes | Yes | No | No | Yes | No | No |
| Comment | | Only if provider supports this[1] | | Only if provider supports this[1] | Deprecated[3] | Mostly used in CI systems that <br/>client-secret can be stored securely | If provider supports it | | Deprecated[4] |
Copy link
Contributor

@deads2k deads2k Mar 15, 2024

Choose a reason for hiding this comment

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

let's use this row to break down each cell with

  1. keycloak - [default|not-default], [configurable|not-configurable]
  2. entra - [default|not-default], [configurable|not-configurable]

| | Authorization Code<br/>(public) | Authorization Code<br/>(confidential) | Authorization Code + PKCE<br/>(public) | Authorization Code + PKCE<br/>(confidential) | Implicit Flow<br/>(public) | Client Credentials<br/>(confidential) | Device Code<br/>(public) | Password Grant<br/>(confidential) |
|------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|----------------------------|-----------------------------------------------------------|-----------------------------------------------------------|-----------------------------------|
| Supported | Yes | Yes | Yes | Yes | No | No | No | No |
| Comment | Keycloak - [configurable] Azure Entra ID - [configurable] | Keycloak - [not-configurable] Azure Entra ID - [configurable] | Keycloak - [configurable] Azure Entra ID - [configurable] | Keycloak - [not-configurable] Azure Entra ID - [configurable] | Deprecated[1] | Keycloak - [configurable] Azure Entra ID - [configurable] | Keycloak - [configurable] Azure Entra ID - [configurable] | Deprecated[2] |
Copy link
Contributor

Choose a reason for hiding this comment

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

followup required with keycloak to determine if it's really impossible to configure a confidential client for authorization flows. I'd be extremely suprrised.

@ardaguclu
Copy link
Member Author

/label tide-merge-method-squash

Copy link
Contributor

openshift-ci bot commented Mar 15, 2024

@ardaguclu: The label(s) /label tide-merge-method-squash cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, no-qe, downstream-change-needed, rebase/manual, cluster-config-api-changed, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/valid-bug, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

In response to this:

/label tide-merge-method-squash

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/test-infra repository.

@ardaguclu
Copy link
Member Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 15, 2024
@deads2k
Copy link
Contributor

deads2k commented Mar 15, 2024

cell rendering still doesn't show newline on github, but I'm ok dealing with that later

/approve

will leave lgtm with standa.

Copy link
Contributor

openshift-ci bot commented Mar 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k

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

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 15, 2024
@deads2k
Copy link
Contributor

deads2k commented Mar 18, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2024
@ardaguclu
Copy link
Member Author

/retest

Copy link
Contributor

openshift-ci bot commented Mar 18, 2024

@ardaguclu: all tests passed!

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 0a68409 into openshift:master Mar 18, 2024
2 checks passed
@ardaguclu ardaguclu deleted the oc-login-external-oidc branch March 18, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants