Skip to content

Commit

Permalink
[oidc] error on unsuccessful Discovery URL
Browse files Browse the repository at this point in the history
  • Loading branch information
joriszwart committed Apr 19, 2021
1 parent 19c3059 commit e116a14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion providers/openidConnect/openidConnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type OpenIDConfig struct {
// If OpenID discovery is enabled, the end_session_endpoint field can optionally be provided
// in the discovery endpoint response according to OpenID spec. See:
// https://openid.net/specs/openid-connect-session-1_0-17.html#OPMetadata
EndSessionEndpoint string `json:"end_session_endpoint, omitempty"`
EndSessionEndpoint string `json:"end_session_endpoint,omitempty"`
Issuer string `json:"issuer"`
}

Expand Down Expand Up @@ -374,6 +374,10 @@ func getOpenIDConfig(p *Provider, openIDAutoDiscoveryURL string) (*OpenIDConfig,
}
defer res.Body.Close()

if res.StatusCode < 200 || res.StatusCode >= 300 {
return nil, fmt.Errorf("Non-success code for Discovery URL: %d", res.StatusCode)
}

body, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
Expand Down

0 comments on commit e116a14

Please sign in to comment.