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

Add fields to the /acl/auth-methods endpoint. #9741

Merged
merged 2 commits into from
Feb 17, 2021

Conversation

markan
Copy link
Contributor

@markan markan commented Feb 9, 2021

Add fields to the /acl/auth-methods endpoint.

A GET of the /acl/auth-methods/:name endpoint returns the fieldsMaxTokenTTL and TokenLocality, while a LIST (/acl/auth-methods) does
not.

The list command returns a filtered subset of the full set. This is
somewhat deliberate, so that secrets aren't shown, but the TTL and
Locality fields aren't (IMO) security critical, and it is useful for
the front end to be able to show them.

For consistency these changes mirror the 'omit empty' and string
representation choices made for the GET call.

This includes changes to the gRPC and API code in the client.

The new output looks similar to this
curl 'http://localhost:8500/v1/acl/auth-methods' | jq '.'

{
"MaxTokenTTL": "8m20s",
"Name": "minikube-ttl-local2",
"Type": "kubernetes",
"Description": "minikube auth method",
"TokenLocality": "local",
"CreateIndex": 530,
"ModifyIndex": 530,
"Namespace": "default"
}
]

Signed-off-by: Mark Anderson [email protected]

@hashicorp-cla
Copy link

hashicorp-cla commented Feb 9, 2021

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the theme/api Relating to the HTTP API interface label Feb 9, 2021
@hashicorp-ci
Copy link
Contributor

🤔 Double check that this PR does not require a changelog entry in the .changelog directory. Reference

@markan markan force-pushed the markan/extend_auth_method_list branch from 88d054e to c0a50d8 Compare February 9, 2021 23:09
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 9, 2021 23:09 Inactive
@vercel vercel bot temporarily deployed to Preview – consul February 9, 2021 23:09 Inactive
@markan markan marked this pull request as ready for review February 10, 2021 18:49
Copy link
Member

@mkeeler mkeeler left a comment

Choose a reason for hiding this comment

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

LGTM, I assume this was just an oversight when adding the locality and max ttl to the authmethod and agree that it would be useful in the list endpoint.

api/acl_test.go Outdated Show resolved Hide resolved
@rboyer
Copy link
Member

rboyer commented Feb 12, 2021

I feel like the PR title should be about /acl/auth-methods endpoint

@markan markan changed the title A GET of the /acl/auth-method/:name endpoint returns the fields Add fields to the /acl/auth-methods endpoint. Feb 12, 2021
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 13, 2021 02:30 Inactive
@vercel vercel bot temporarily deployed to Preview – consul February 13, 2021 02:30 Inactive
@markan markan force-pushed the markan/extend_auth_method_list branch from 25d2437 to 5c6a9da Compare February 13, 2021 02:46
@vercel vercel bot temporarily deployed to Preview – consul February 13, 2021 02:46 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 13, 2021 02:46 Inactive
MaxTokenTTL and TokenLocality, while a LIST (/acl/auth-methods) does
not.

The list command returns a filtered subset of the full set. This is
somewhat deliberate, so that secrets aren't shown, but the TTL and
Locality fields aren't (IMO) security critical, and it is useful for
the front end to be able to show them.

For consistency these changes mirror the 'omit empty' and string
representation choices made for the GET call.

This includes changes to the gRPC and API code in the client.

The new output looks similar to this
curl 'http://localhost:8500/v1/acl/auth-methods' | jq '.'

  {
    "MaxTokenTTL": "8m20s",
    "Name": "minikube-ttl-local2",
    "Type": "kubernetes",
    "Description": "minikube auth method",
    "TokenLocality": "local",
    "CreateIndex": 530,
    "ModifyIndex": 530,
    "Namespace": "default"
  }
]

Signed-off-by: Mark Anderson <[email protected]>
@markan markan force-pushed the markan/extend_auth_method_list branch from 5c6a9da to 870f298 Compare February 16, 2021 19:26
@vercel vercel bot temporarily deployed to Preview – consul February 16, 2021 19:26 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 16, 2021 19:26 Inactive
Signed-off-by: Mark Anderson <[email protected]>
@vercel vercel bot temporarily deployed to Preview – consul February 17, 2021 15:45 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 17, 2021 15:45 Inactive
@markan markan merged commit b9d22f4 into master Feb 17, 2021
@markan markan deleted the markan/extend_auth_method_list branch February 17, 2021 16:16
@hashicorp-ci
Copy link
Contributor

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/328484.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/api Relating to the HTTP API interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants