possibility to use token role when creating child token #349
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.
This PR allows you to - optionally - use a predefined token role when requesting new child tokens while
limiting policies.Instead of requiring the requesting AppRole to have to include all possible
token_policies(and then just using a subset), the requesting AppRole can just be granted a single policy again granting to create atokenusing a predefinedtoken role(which can request otherpoliciesNOT already included within thetoken_policies)Testing done
Sorry, I still need to try to write tests. I am not really a Java developer (getting it all running - and debugging - was already quite a pain for me. I will try to add those.
But what I did:
So the AppRole
jenkinsis created with only policyjenkins_mainassigned viatoken_policies.jenkins_mainitself allows to create child tokens using thejenkinstoken role. When trying to create child tokens, onlydummy1ordummy2maybe be used (possibility to use globbing). So in this example,dummy1can read the secret atdummy-secrets/data/dummy1Configure global Vault plugin by just providing the
url, the AppRole and the path prefixdummy-secrets.With that, using the slightly adjusted example from the README in a pipeline
Submitter checklist