feat: add support for capturing id token returned by Azure OIDC login #20991
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.
Reported by ent customer on ticket 4688. related thread: https://codercom.slack.com/archives/C014JH42DBJ/p1763983935459739
This PR adds the
oauth_id_tokencolumn to theuser_linkstable and has Coder capture and store theid_tokenreturned by Azure as part of the OIDC login process to the new column. This is needed because Azure provides both anaccess_tokenandid_tokenvalue in it's response to coderd, but the access token is a v1 token which has an audience and issuer which corresponds to microsoft graph, while the id token is issued against the customer tenant.The reasoning behind this is the access token / v1 graph token is only able to be validated by microsoft, which means when other services within Coder make use of the Azure OIDC token, such as authenticating to Vault, this fails. Authenticating manually (decrypting TLS, capturing the
id_tokenfrom the Azure response) using theid_tokenworks as desired.Ref: https://github.com/coder/registry/blob/main/registry/coder/modules/vault-jwt/main.tf#L62 and https://github.com/coder/registry/blob/main/registry/coder/modules/vault-jwt/run.sh#L119
The second half of this is a Terraform provider update - coder/terraform-provider-coder#471