add userinfo support for OpenID (#12469)

Some identity providers like GitLab do not provide
information about group membership as part of the
identity token claims. They only expose it via OIDC compatible
'/oauth/userinfo' endpoint, as described in the OpenID
Connect 1.0 sepcification.

But this of course requires application to make sure to add
additional accessToken, since idToken cannot be re-used to
perform the same 'userinfo' call. This is why this is specialized
requirement. Gitlab seems to be the only OpenID vendor that requires
this support for the time being.

fixes #12367
This commit is contained in:
Harshavardhana
2021-09-13 16:22:14 -07:00
committed by GitHub
parent d144958669
commit af78c3925a
7 changed files with 160 additions and 55 deletions

View File

@@ -100,7 +100,7 @@ func TestJWTAzureFail(t *testing.T) {
t.Fatalf("Unexpected id %s for the validator", cfg.ID())
}
if _, err := cfg.Validate(jwtToken, ""); err == nil {
if _, err := cfg.Validate(jwtToken, "", ""); err == nil {
// Azure should fail due to non OIDC compliant JWT
// generated by Azure AD
t.Fatal(err)
@@ -154,7 +154,7 @@ func TestJWT(t *testing.T) {
t.Fatal(err)
}
if _, err := cfg.Validate(u.Query().Get("Token"), ""); err == nil {
if _, err := cfg.Validate(u.Query().Get("Token"), "", ""); err == nil {
t.Fatal(err)
}
}