-
Notifications
You must be signed in to change notification settings - Fork 244
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
docs: adds decision record for HashiCorp Vault auth refactor #4720
Conversation
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.
A few comments, but otherwise I'm fine with this.
The sole common point between the authentication methods is the ability to provide a `client_token` that can be used to authenticate with HashiCorp Vault. | ||
|
||
```java | ||
public interface HashicorpVaultAuth { |
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.
This name is not intuitive. It should reflect what role it provides.
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.
Which name would be more intuitive?
Only other fitting name that comes to mind for me would be HashicorpVaultTokenProvider
.
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.
That name is better IMO
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.
The name has been adjusted.
|
||
```java | ||
@NotNull | ||
private Headers getHeaders() { |
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.
At first look, I would prefer the token to be passed into this function (also valueAuth to be renamed because it is not intuitive) rather than computed from a member at this point
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.
Passing the token into this function instead of retrieving it inside would lead to duplicate code in four places.
While it would only be one line, the call to retrieve the token has to be made either way inside the public methods of the HashicorpVaultClient
.
Doing it during header generation in a central place seems the most sensible to me.
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'm talking about the vaultAuth.vaultToken() call. That value can be passed to the method instead of having the method rely on a class member. I generally don't like getXXX methods that rely on members since it is not apparent what the inputs of the method are.
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.
Moved the token to the parameters of getHeaders
.
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.
Can you please distinguish class names better before I proceed with a further review? Specifically, HashicorpVaultAuthTokenProvider
and HashicorpVaultTokenAuth
are extremely confusing.
@jimmarino did a pass for the class names. Also saw the PR #4749 from @paullatzelsperger which already takes care of the refactoring part for the current token authentication and would reroute the changes specified for the |
Sorry, but these names are completely confusing and do not align. For example: @Provider(isDefault = true)
public HashicorpVaultAuthClientTokenProvider HashicorpVaultAuthClientTokenProvider() {
return new HashicorpVaultAuthTokenImpl();
} This makes what should be simple code difficult to follow and is a sign that the concepts underpinning this PR are not fully thought through. I think you should go back and clarify this PR before asking the committers to review it again. |
that PR just cleans up a - frankly speaking - poor implementation of the HashicorpVault, and it adds a facility to do remote signing/verifying and key rotation. |
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 have two major gripes with this PR:
- succinctness: a lot of stuff is explained, that is already covered by documentation. This would make the DR much shorter and more concise.
- design: a few services seem to emerge from the Hashicorp Vault area (again, PR feat: implement Hashicorp Vault signing service #4749):
- a secure key-value store (the "vault") ->
HashicorpVault
- a signing service
HashicorpSignatureService
- a health check service
HashicorpHealthService
all of these services share the same auth method. I think this DR should mention that.
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
docs/developer/decision-records/2024-12-13-vault-authentication-refactor/README.md
Outdated
Show resolved
Hide resolved
@jimmarino the concepts for the authentication interface are taken straight from HashiCorp Vault. |
@paullatzelsperger I cut a few explanations to make the decision record more concise, incorporated the changes from #4749 and made sure to mention the different services that use the authentication method. |
Names like |
89353e1
to
3f8aadf
Compare
Kept the naming simple with the interface |
This pull request is stale because it has been open for 7 days with no activity. |
Superseded by #4802 |
What this PR changes/adds
This PR adds a decision record that outlines a refactor of the authentication inside the vault-hashicorp extension.
Why it does that
Currently, the only possible authentication method for HashiCorp Vault is token authentication which is hardcoded into the extension.
To pave the way for additonal authentication methods, the authentication of vault-hashicorp extension needs to be extensible.
This PR outlines the changes needed to achieve interchangeable authentication.
Further notes
This version of the decision record removes the registry and spi in favor of a default implementation that can be overwritten.
Linked Issue(s)
Closes #4672
Related discussion: #4374
Previous closed PR: #4673