Skip to content

Commit

Permalink
Handle ValidateURL fallback for nil & empty struct cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Meves committed Dec 24, 2020
1 parent 816d9a4 commit 4b28e68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions providers/keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func NewKeycloakProvider(p *ProviderData) *KeycloakProvider {
// email and groups.
func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
// Fallback to ValidateURL if ProfileURL not set for legacy compatibility
userinfoURL := p.ValidateURL.String()
if p.ProfileURL != nil {
userinfoURL = p.ProfileURL.String()
profileURL := p.ValidateURL.String()
if p.ProfileURL.String() != "" {
profileURL = p.ProfileURL.String()
}

json, err := requests.New(userinfoURL).
json, err := requests.New(profileURL).
WithContext(ctx).
SetHeader("Authorization", "Bearer "+s.AccessToken).
Do().
Expand Down

0 comments on commit 4b28e68

Please sign in to comment.