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 errors types to Verify to differentiate between token and STS errors #53

Merged
merged 1 commit into from
Feb 28, 2018

Conversation

mattlandis
Copy link
Contributor

It is useful to track latency for cases where STS is called differently
than when the token passed in does not meet the requirements. This
splits the errors returned by token.Verify into two groups
TokenFormatError and STSError to allow users to differentiate between
the two.

Signed-off-by: Matt Landis matlan@amazon.com

Copy link
Contributor

@nckturner nckturner left a comment

Choose a reason for hiding this comment

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

nit, otherwise LGTM

if err == nil || !strings.Contains(err.Error(), expectedErr) {
t.Errorf("err should have contained '%s' was '%s'", expectedErr, err)
}
}

func isSTSError(t *testing.T, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd prefer validateSTSError or assertSTSError because you aren't returning a bool, your asserting and erroring on failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

…ors.

It is useful to track latency for cases where STS is called differently
than when the token passed in does not meet the requirements.  This
splits the errors returned by token.Verify into two groups
TokenFormatError and STSError to allow users to differentiate between
the two.

Signed-off-by: Matt Landis <matlan@amazon.com>
@mattlandis
Copy link
Contributor Author

@nckturner updated name and rebased.

@nckturner nckturner merged commit b53aa08 into kubernetes-sigs:master Feb 28, 2018
joanayma pushed a commit to joanayma/aws-iam-authenticator that referenced this pull request Aug 11, 2021
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.

2 participants