Handle ValidateURL fallback for nil & empty struct cases
This commit is contained in:
parent
816d9a4566
commit
4b28e6886c
@ -64,12 +64,12 @@ func NewKeycloakProvider(p *ProviderData) *KeycloakProvider {
|
|||||||
// email and groups.
|
// email and groups.
|
||||||
func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
|
func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
|
||||||
// Fallback to ValidateURL if ProfileURL not set for legacy compatibility
|
// Fallback to ValidateURL if ProfileURL not set for legacy compatibility
|
||||||
userinfoURL := p.ValidateURL.String()
|
profileURL := p.ValidateURL.String()
|
||||||
if p.ProfileURL != nil {
|
if p.ProfileURL.String() != "" {
|
||||||
userinfoURL = p.ProfileURL.String()
|
profileURL = p.ProfileURL.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
json, err := requests.New(userinfoURL).
|
json, err := requests.New(profileURL).
|
||||||
WithContext(ctx).
|
WithContext(ctx).
|
||||||
SetHeader("Authorization", "Bearer "+s.AccessToken).
|
SetHeader("Authorization", "Bearer "+s.AccessToken).
|
||||||
Do().
|
Do().
|
||||||
|
Loading…
Reference in New Issue
Block a user