Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Adds support for token based authentication #23
Adds support for token based authentication #23
Changes from 3 commits
ac73e0f
98651dc
b3b2146
abc8820
aed8032
9d081f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be encapsulated inside the library and not given by the developer. So the developer will only state that he/she is using a token from a file. The file should be given in the CONJUR_AUTHN_TOKEN_FILE environment variable or in the Conjur class constructor (instead of getting a token).
Once this is encapsulated, we need to also add a wait mechanism, in case the application is trying to use the token file before it got created by the sidecar. See similar mechanism here: https://github.com/cyberark/conjur-api-go/blob/b75a31bafc95e06780b81df18ba5dba8dd0dc32f/conjurapi/authn/token_file_authenticator.go#L23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this class should be called AuthnFileClient.
Even though reading a token from a file is currently used in K8s, it could easily be used in other flows as well and therefore I think that a generic name is better. We did the same in the other APIs, such as in Go: https://github.com/cyberark/conjur-api-go/blob/b75a31bafc95e06780b81df18ba5dba8dd0dc32f/conjurapi/authn/token_file_authenticator.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @rafis3, that we should get this to line up with our Go API client. I think we can do this iteratively though, lining it up with the
TokenAuthenticator
[1], rather than theTokenFileAuthenticator
. I would suggest we rename this toAuthnTokenProvider
. We can then add a ticket to add aAuthnTokenProvider
that includes the file watch support.[1] https://github.com/cyberark/conjur-api-go/blob/b75a31bafc95e06780b81df18ba5dba8dd0dc32f/conjurapi/authn/token_authenticator.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add that I think the should be updated to include the environment variable, but I would suggest we use
CONJUR_AUTHN_TOKEN
rather than the file path for this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that according to the official standard, you can either say K8s, k8s or Kubernetes but never K8S.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should reference K8s at all, this is just a normal Conjur access token at this point, correct?