feat: add auth accessor resolution to IdentityTokenRole template field#305
Open
dyna-stadt wants to merge 1 commit intoredhat-cop:mainfrom
Open
feat: add auth accessor resolution to IdentityTokenRole template field#305dyna-stadt wants to merge 1 commit intoredhat-cop:mainfrom
dyna-stadt wants to merge 1 commit intoredhat-cop:mainfrom
Conversation
Extracts the auth accessor resolution logic from Policy into a shared ResolveAuthAccessors utility function and applies it to IdentityTokenRole's template field. This allows the same ${auth/<path>/@Accessor} placeholder syntax to be used in identity token role templates, automatically replacing placeholders with actual accessor values from Vault's sys/auth endpoint, ref: NOISSUE
Contributor
Author
|
@raffaelespazzoli |
Collaborator
|
please rebase off of main, you are using an old pipeline. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
${auth/<path>/@accessor}placeholder resolution logic from Policy into a sharedResolveAuthAccessorsutility function inapi/v1alpha1/utils/commons.goPolicy.PrepareInternalValues()to use the new shared utility, removing duplicated code and unused importsIdentityTokenRole.PrepareInternalValues(), enabling${auth/<path>/@accessor}placeholders in the template fielddocs/identities.mdwith documentation and an example for the new IdentityTokenRole template accessor syntaxMotivation
The
${auth/<auth engine path>/@accessor}placeholder syntax was previously only supported inPolicyHCL rules. However, identity token role templates often need to reference auth engine accessors as well (e.g.{{identity.entity.aliases.<accessor>.metadata.service_account_namespace}}). Without this feature, users hadto manually look up and hard-code accessor values, which change across Vault instances and are not portable.
Example
The operator resolves
${auth/kubernetes/@accessor} to the actual accessor value (e.g. auth_kubernetes_804f1655) before writing the role to Vault.Note: The Vault role used for authentication must have read and list access to sys/auth for resolution to work. Unresolved placeholders are left as-is.