-
Notifications
You must be signed in to change notification settings - Fork 273
command/ca/token: support custom "user" claim #1375
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
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.
Hi @fuhry, this looks quite good, but I noticed this doesn't work for SSH tokens:
$ step ca token --set foo=bar --set loo=asd --set-file <(echo '{"pree":1, "foor":{"1": "222"}}' ) --ssh localhost | step crypto jwt inspect --insecure
✔ Provisioner: mariano (JWK) [kid: nvgnR8wSzpUlrt_tC3mvrhwhBx9Y7T1WL_JjcFVWYBQ]
Please enter the password to decrypt the provisioner key:
{
"header": {
"alg": "ES256",
"kid": "nvgnR8wSzpUlrt_tC3mvrhwhBx9Y7T1WL_JjcFVWYBQ",
"typ": "JWT"
},
"payload": {
"aud": "https://ca.smallstep.com:8443/1.0/ssh/sign",
"exp": 1740512971,
"iat": 1740512671,
"iss": "mariano",
"jti": "36148a58bc56c0383f86f3d60e4d9f1fc7193d96319e52d2323a4d6d02ffb908",
"nbf": 1740512671,
"sha": "36c6b2a81b492ec11f2c3fd576716d91bd944c0e77bf9693e229e841b91ada09",
"step": {
"ssh": {
"certType": "user",
"keyID": "localhost",
"principals": [],
"validAfter": "",
"validBefore": ""
}
},
"sub": "localhost"
},
"signature": "zc5VERa4l3Hyu4wNuP3YgWUu2vPCLtq2VwbXUF9EPCqZ7kxSAfnX098C_rI-aIwePlib8PYymKcfM1a-qkR6tQ"
}
And there we have the step
claim, I wonder if we want to add the user
claim inside that. @hslatman what do you think about this?
@maraino Thanks for looking this over!
Thanks for flagging this - I'll look into what it will take to get this working for SSH tokens. Are there any other token types I should plan to support?
I initially considered this and decided to make a separate
So I think it's best to keep Will request re-review after I've added and tested SSH token support. |
09c4b13
to
2da3a3f
Compare
Sure, let's keep using |
Having them in their own namespace sounds OK to me, and I think The thing that could confuse users is that the Considering the previous paragraph, it could help if the namespace is not |
Ahh yes, I love a good naming debate! 😅
@hslatman I'll add clarification to the Is the capitalization difference something we want to address? This is particularly technically-incorrect here, as JWT claims are nominally all-lowercase, so we are faced with several choices, all not great:
|
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.
Thanks, @fuhry. This looks good to me.
Let me confirm internally if we need any changes before merging this.
Add the `--set` and `--set-file` flags to the `step ca token` command, allowing the user to set keys in the "user" claim in the resulting JWT. Signed-off-by: Dan Fuhry <[email protected]>
2da3a3f
to
8abadfc
Compare
Thanks, I've pushed a small change to the docs with the aforementioned clarification. |
Add the
--set
and--set-file
flags to thestep ca token
command, allowing the user to set keys in the "user" claim in the resulting JWT.Name of feature:
Custom user data in tokens
Pain or issue this feature alleviates:
Lack of ability to pass custom trusted data to a template without a pre-existing CSR.
Is there documentation on how to use this feature? If so, where?
Yes, in the CLI help for
step ca token
.In what environments or workflows is this feature supported?
Online JWT token flow
In what environments or workflows is this feature explicitly NOT supported (if any)?
Offline token flow, because
cautils.OfflineTokenFlow
doesn't supporttokenOpts
. Enforced by flags validation.