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

Remove update verb requirement when creating Tokens #14506

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

marcoandredinis
Copy link
Contributor

@marcoandredinis marcoandredinis commented Jul 15, 2022

The used method to create a token in the UI is UpsertToken.
This method requires Create and Update verbs.

It shouldn't be necessary to have the Update verb - we are only creating
and not changing anything.

This PR adds

  • a new method - CreateToken - which only requires the Create verb.
  • apiserver uses this method to issue a new token

Demo
User with role that doesn't have update on tokens:

Can successfully generate tokens:

Fixes #13218

@marcoandredinis marcoandredinis marked this pull request as ready for review July 15, 2022 11:11
Copy link
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

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

Was create without update on tokens completely useless until now?

@marcoandredinis
Copy link
Contributor Author

Was create without update on tokens completely useless until now?

No, there's another method which only requires the create verb
This other method is the one being used when we issue tctl tokens add
+info #13218 (comment)

@marcoandredinis marcoandredinis force-pushed the marco/grpc_add_create_token_api branch from 3633f76 to 29f7ee3 Compare July 18, 2022 06:50
@marcoandredinis marcoandredinis force-pushed the marco/grpc_add_create_token_api branch 2 times, most recently from 9d287fb to 3494320 Compare July 18, 2022 16:38
lib/web/apiserver_test.go Outdated Show resolved Hide resolved
@marcoandredinis marcoandredinis force-pushed the marco/grpc_add_create_token_api branch from 3494320 to 29f1b3c Compare July 19, 2022 07:00
marcoandredinis and others added 2 commits July 19, 2022 08:03
The used method to create a token in the UI is UpsertToken.
This method requires Create and Update verbs.

It shouldn't be necessary to have the Update verb - we are only creating
and not changing anything.

This PR adds
- a new method - CreateToken - which only requires the Create verb.
- apiserver uses this method to issue a new token
Co-authored-by: Isaiah Becker-Mayer <[email protected]>
@marcoandredinis marcoandredinis force-pushed the marco/grpc_add_create_token_api branch from be7d016 to c21edb6 Compare July 19, 2022 07:03
@marcoandredinis marcoandredinis enabled auto-merge (squash) July 19, 2022 07:03
@marcoandredinis marcoandredinis merged commit 9fa5705 into master Jul 19, 2022
@github-actions
Copy link

@marcoandredinis See the table below for backport results.

Branch Result
branch/v10 Failed

@marcoandredinis marcoandredinis deleted the marco/grpc_add_create_token_api branch July 19, 2022 07:47
@marcoandredinis marcoandredinis restored the marco/grpc_add_create_token_api branch July 19, 2022 07:48
@github-actions
Copy link

@marcoandredinis See the table below for backport results.

Branch Result
branch/v10 Failed

@marcoandredinis marcoandredinis deleted the marco/grpc_add_create_token_api branch July 19, 2022 07:49
marcoandredinis added a commit that referenced this pull request Jul 19, 2022
The used method to create a token in the UI is UpsertToken.
This method requires Create and Update verbs.

It shouldn't be necessary to have the Update verb - we are only creating
and not changing anything.

This PR adds
- a new method - CreateToken - which only requires the Create verb.
- apiserver uses this method to issue a new token

Co-authored-by: Isaiah Becker-Mayer <[email protected]>
marcoandredinis added a commit that referenced this pull request Jul 19, 2022
…14624)

Remove `update` verb requirement when creating Tokens (#14506)

The used method to create a token in the UI is UpsertToken.
This method requires Create and Update verbs.

It shouldn't be necessary to have the Update verb - we are only creating
and not changing anything.

This PR adds
- a new method - CreateToken - which only requires the Create verb.
- apiserver uses this method to issue a new token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A user with permissions to create a token cannot create it in the web gui
3 participants