Skip to content

Commit

Permalink
auth-openshift: OIDC discovery issuer information must match the conf…
Browse files Browse the repository at this point in the history
…igured issuer
  • Loading branch information
stlaz committed Nov 22, 2023
1 parent bfca9a0 commit 3eb4df0
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions pkg/auth/auth_openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func (o *openShiftAuth) getOIDCDiscoveryInternal(ctx context.Context) (*oidcDisc
wellKnownURL, err)
}

if err := validateAbsURL(metadata.Issuer); err != nil { // FIXME: must validate issuer == o.Issuer
return nil, err
if metadata.Issuer != o.issuerURL {
return nil, fmt.Errorf("discovery provided unexpected issuer URL (%s)", metadata.Issuer)
}

if err := validateAbsURL(metadata.Auth); err != nil {
Expand All @@ -108,19 +108,6 @@ func (o *openShiftAuth) getOIDCDiscoveryInternal(ctx context.Context) (*oidcDisc
return nil, err
}

// Make sure we can talk to the issuer endpoint.
req, err = http.NewRequest(http.MethodHead, metadata.Issuer, nil)
if err != nil {
return nil, err
}

resp, err = o.getClient().Do(req.WithContext(ctx))
if err != nil {
return nil, fmt.Errorf("request to OAuth issuer endpoint %s failed: %v",
metadata.Token, err)
}
defer resp.Body.Close()

return metadata, nil
}

Expand Down

0 comments on commit 3eb4df0

Please sign in to comment.