-
Notifications
You must be signed in to change notification settings - Fork 62
Allows TokenVendor to read SA from JWT.SUB #539
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
Changes implementation of token vendor OAuth2 endpoit to read custom service account information from JWT.SUB instead from request body. Callers cannot easily add extra information to JWT Token request body as common libraries do not allow to alter the resulting request from outside before it is sent to the server. This change ensures that callers can specify service account in a JWT Claim SUBJECT field which is then considered by TokenVendor when issuing a new token. This field was previously unused by TV and feels very natural to be provided without need for custom claims to be introduced. The device ID information is passed in ISS field of the JWT Request. RobotAuth implementatiuon provides two code paths for generating JWT tokens for robot. One is used to exclusively communicate with TokenVendor, this one is not modified. The second path is used for obtaining GCP tokens. This path allows setting custom SA in subject claim.
@rastislav-vcrs is it intentional that we've been added while it's in draft status? not clear if I should review / take a high-level glance / wait for status change. |
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.
Please also update the README
https://github.com/googlecloudrobotics/core/blob/main/src/go/cmd/token-vendor/README.md
@drigz It is intentional, so you can take a look and tell me if I overlooked something before we go through the formal approval. So take a high-level look if that direction makes sense from your perspective or not. Thank you. |
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.
Just one nit
This reverts commit 4d0c8f3, https://cloudlogging.app.goo.gl/M1JMPrN1rMJf37Y68 See https://cloudlogging.app.goo.gl/4rL1Y3WxtwGJLmiT9 ``` Error: "service account "dev-ensonic1-c-googlers-com" not allowed" message: "unable to retrieve cloud access token with given JWT" ``` Rollback tested on robco-ensonic: 
Changes implementation of token vendor OAuth2 endpoit to read custom service account information from JWT.SUB instead from request body.
Callers cannot easily add extra information to JWT Token request body as common libraries do not allow to alter the resulting request from outside before it is sent to the server. This change ensures that callers can specify service account in a JWT Claim SUBJECT field which is then considered by TokenVendor when issuing a new token. This field was previously unused by TV and feels very natural to be provided without need for custom claims to be introduced. The device ID information is passed in ISS field of the JWT Request.
RobotAuth implementation provides two code paths for generating JWT tokens for robot. One is used to exclusively communicate with TokenVendor, this one is not modified. The second path is used for obtaining GCP tokens. This path allows setting custom SA in subject claim.