added option to retrieve the OIDC user info from the id_token payload

This commit is contained in:
Gani Georgiev
2024-10-12 10:16:01 +03:00
parent 95d5ee40b0
commit 3c87df9e55
40 changed files with 465 additions and 218 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"maps"
"net/http"
"golang.org/x/oauth2"
@@ -21,6 +22,7 @@ type BaseProvider struct {
userInfoURL string
scopes []string
pkce bool
extra map[string]any
}
// Context implements Provider.Context() interface method.
@@ -123,6 +125,16 @@ func (p *BaseProvider) SetUserInfoURL(url string) {
p.userInfoURL = url
}
// Extra implements Provider.Extra() interface method.
func (p *BaseProvider) Extra() map[string]any {
return maps.Clone(p.extra)
}
// SetExtra implements Provider.SetExtra() interface method.
func (p *BaseProvider) SetExtra(data map[string]any) {
p.extra = data
}
// BuildAuthURL implements Provider.BuildAuthURL() interface method.
func (p *BaseProvider) BuildAuthURL(state string, opts ...oauth2.AuthCodeOption) string {
return p.oauth2Config().AuthCodeURL(state, opts...)