git.iko.soy/typeable/oauth2-proxy
on master help sign in
Handle ValidateURL fallback for nil & empty struct cases
4b28e68Nick Meves
providers/keycloak.go+4−4
@@ -64,12 +64,12 @@ func NewKeycloakProvider(p *ProviderData) *KeycloakProvider {
64// email and groups.
64// email and groups.
65func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
65func (p *KeycloakProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
66 // Fallback to ValidateURL if ProfileURL not set for legacy compatibility
66 // Fallback to ValidateURL if ProfileURL not set for legacy compatibility
67− userinfoURL := p.ValidateURL.String()
67+ profileURL := p.ValidateURL.String()
68− if p.ProfileURL != nil {
68+ if p.ProfileURL.String() != "" {
69− userinfoURL = p.ProfileURL.String()
69+ profileURL = p.ProfileURL.String()
70 }
70 }
71
71
72− json, err := requests.New(userinfoURL).
72+ json, err := requests.New(profileURL).
73 WithContext(ctx).
73 WithContext(ctx).
74 SetHeader("Authorization", "Bearer "+s.AccessToken).
74 SetHeader("Authorization", "Bearer "+s.AccessToken).
75 Do().
75 Do().