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

Label tokens #22184

Merged
merged 2 commits into from
Aug 16, 2019
Merged

Label tokens #22184

merged 2 commits into from
Aug 16, 2019

Conversation

cbron
Copy link
Contributor

@cbron cbron commented Aug 14, 2019

Depends on: Types PR: rancher/types#940

Adds a label to Rancher management created tokens to help categorize them. Examples:

Helm token: "authn.management.cattle.io/kind": "helm",
Telemetry token: "authn.management.cattle.io/kind": "telemetry",
User login: "authn.management.cattle.io/kind": "session",

Note

  • Won't add labels to user (custom) tokens.
  • Won't add labels for existing tokens.

vendor.conf Outdated Show resolved Hide resolved
@cbron cbron requested a review from daxmc99 August 14, 2019 23:44
pkg/auth/tokens/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@daxmc99 daxmc99 left a comment

Choose a reason for hiding this comment

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

LGTM This adds labels to tokens

cc @vincent99

@cbron cbron requested a review from dramich August 15, 2019 20:09
@cbron cbron force-pushed the label-tokens branch 2 times, most recently from 37529a7 to 30cb12a Compare August 16, 2019 01:44
def test_auth_label(admin_mc, user_factory):
user = user_factory()
k8s_client = CustomObjectsApi(admin_mc.k8s_client)
tokens = k8s_client.list_cluster_custom_object(
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a wait_for in here to ensure we actually get the users token before attempting to access it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed now. Also re-vendored types, which included another change but it looks legit.

@dramich
Copy link
Contributor

dramich commented Aug 16, 2019

lgtm

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

3 participants