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

OpenID Connect: Identify user by more JWT claims than just a single one #71715

Closed
heikoettelbruecksap opened this issue Dec 4, 2018 · 9 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/auth Categorizes an issue or PR as relevant to SIG Auth.

Comments

@heikoettelbruecksap
Copy link

Summary:

In our use case, ID tokens of our OpenID connect provider (CF UAA) don't have a single claim that

  • uniquely identifies a user and
  • is human-readable (= usable in a Kubernetes cluster, e.g. for role bindings, auditing).
    However, currently the API server only supports choosing a single claim (=> usernameClaim) which is treated as (expected to be unique) user name within the cluster.
    Basically I see two options to resolve this situation:
  • Specific approach for this use case: Extend the OpenID connect provider to add an additional claim which is both unique and human-readable.
  • Generic approach: Extend the API server to allow specifying a simple pattern to define the cluster-internal user name (potentially using multiple claims, e.g. "{origin}|{user_name}").

=> Do you have similar use cases, so the generic approach would help there, too?

Details:

We use CF UAA as OpenID connect provider for Kubernetes clusters, which supports connecting multiple external identity providers (per single identity zone / tenant). Respective ID tokens issued by UAA contain certain information that could be used to identify users from the cluster (e.g. for role bindings within the cluster):

  • sub: unique identifier for the user, however a GUID
  • email: email address of the user
  • origin: identifier for the identity provider by which the user authenticated to UAA
  • user_name: user name of the user (within the used identity provider; there might be users from other identity providers with the same user_name, so user_name itself is not yet unique)
  • user_id: same as "sub"
@heikoettelbruecksap
Copy link
Author

@kubernetes/sig-auth-feature-requests

@k8s-ci-robot
Copy link
Contributor

@heikoettelbruecksap: Reiterating the mentions to trigger a notification:
@kubernetes/sig-auth-feature-requests

In response to this:

@kubernetes/sig-auth-feature-requests

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.

@cblecker cblecker transferred this issue from kubernetes/community Dec 4, 2018
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Dec 4, 2018
@heikoettelbruecksap
Copy link
Author

@kubernetes/sig-auth-feature-requests

@k8s-ci-robot k8s-ci-robot added sig/auth Categorizes an issue or PR as relevant to SIG Auth. kind/feature Categorizes issue or PR as related to a new feature. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 4, 2018
@k8s-ci-robot
Copy link
Contributor

@heikoettelbruecksap: Reiterating the mentions to trigger a notification:
@kubernetes/sig-auth-feature-requests

In response to this:

@kubernetes/sig-auth-feature-requests

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.

@heikoettelbruecksap
Copy link
Author

@kubernetes/sig-auth-feature-requests

@k8s-ci-robot
Copy link
Contributor

@heikoettelbruecksap: Reiterating the mentions to trigger a notification:
@kubernetes/sig-auth-feature-requests

In response to this:

@kubernetes/sig-auth-feature-requests

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.

@liggitt
Copy link
Member

liggitt commented Dec 12, 2018

sub: unique identifier for the user, however a GUID
...
origin: identifier for the identity provider by which the user authenticated to UAA
user_name: user name of the user (within the used identity provider; there might be users from other identity providers with the same user_name, so user_name itself is not yet unique)

in this case, using "{origin}|{user_name}" sounds counter to the intent of the identity provider. presumably the sub uniquely identifies the user independently of the authentication origin to allow authentication via other origins to map to the same user. By taking "{origin}|{user_name}" as the identity, it means the same user authenticating via a different origin would lose all kubernetes permissions granted to their first login method

expecting a single claim from the provider the represent the identity seems safest. if you wanted to allow combining claims like this, you could do so with an authentication webhook that added that on top of oidc validation.

/close

@k8s-ci-robot
Copy link
Contributor

@liggitt: Closing this issue.

In response to this:

sub: unique identifier for the user, however a GUID
...
origin: identifier for the identity provider by which the user authenticated to UAA
user_name: user name of the user (within the used identity provider; there might be users from other identity providers with the same user_name, so user_name itself is not yet unique)

in this case, using "{origin}|{user_name}" sounds counter to the intent of the identity provider. presumably the sub uniquely identifies the user independently of the authentication origin to allow authentication via other origins to map to the same user. By taking "{origin}|{user_name}" as the identity, it means the same user authenticating via a different origin would lose all kubernetes permissions granted to their first login method

expecting a single claim from the provider the represent the identity seems safest. if you wanted to allow combining claims like this, you could do so with an authentication webhook that added that on top of oidc validation.

/close

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.

@enj
Copy link
Member

enj commented Nov 14, 2023

@heikoettelbruecksap with #121078 merged, this should be possible now as an alpha feature in v1.29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/auth Categorizes an issue or PR as relevant to SIG Auth.
Projects
None yet
Development

No branches or pull requests

4 participants