cockroachdb / cockroachdb/cockroach

jwtauthccl: replace getUserinfoEndpoint, fetchGroupsFromUserinfo, fetchJWKS etc with go-oidc

Open
#148,094 0 comments 0 reactions 1 assignee Assigned to @shriramters View on GitHub
C-enhancement P-2 T-product-security
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

`jwtauthccl` currently does its own:

* OIDC discovery and JWKS rotation via `fetchJWKS`
* construction of the UserInfo URL in `getUserinfoEndpoint`
* group-claim retrieval in `fetchGroupsFromUserinfo`

CockroachDB already vendors [go-oidc](https://github.com/coreos/go-oidc) for the OIDC flow in `oidcccl`.
go-oidc package provides:

* `oidc.NewProvider`: automatic discovery, including the JWKS URL
* `provider.Verifier(&oidc.Config{ClientID: …})`: wraps `oidc.NewRemoteKeySet` for key refresh
* `provider.UserInfo(ctx, httpClient)`: fetches and JSON-decodes the UserInfo response ([[pkg.go.dev](https://pkg.go.dev/github.com/coreos/go-oidc/v3/oidc?utm_source=chatgpt.com)][2])

Re-using it inside `jwtauthccl` would retire \~400 LoC of bespoke HTTP code and unify behaviour across SSO entry points.

Jira issue: CRDB-51398

Epic CRDB-54682

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.