cockroachdb / cockroachdb/cockroach
jwtauthccl: replace getUserinfoEndpoint, fetchGroupsFromUserinfo, fetchJWKS etc with go-oidc
- 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
Assessment
This issue has not been assessed yet.