@@ -89,11 +89,12 @@ func (g *DataGathererOIDC) Fetch() (any, int, error) {
8989
9090func (g * DataGathererOIDC ) fetchOIDCConfig (ctx context.Context ) (map [string ]any , error ) {
9191 // Fetch the OIDC discovery document from the well-known endpoint.
92- bytes , err := g .cl .Get ().AbsPath ("/.well-known/openid-configuration" ).Do (ctx ). Raw ( )
93- if err != nil {
92+ result := g .cl .Get ().AbsPath ("/.well-known/openid-configuration" ).Do (ctx )
93+ if err := result . Error (); err != nil {
9494 return nil , fmt .Errorf ("failed to get OIDC discovery document: %s" , k8sErrorMessage (err ))
9595 }
9696
97+ bytes , _ := result .Raw ()
9798 var oidcResponse map [string ]any
9899 if err := json .Unmarshal (bytes , & oidcResponse ); err != nil {
99100 return nil , fmt .Errorf ("failed to unmarshal OIDC discovery document: %v" , err )
@@ -109,11 +110,12 @@ func (g *DataGathererOIDC) fetchJWKS(ctx context.Context) (map[string]any, error
109110 // - on fully private AWS EKS clusters, the URL is still public and might not
110111 // be reachable from within the cluster (https://github.com/aws/containers-roadmap/issues/2038)
111112 // So we are using the default path instead, which we think should work in most cases.
112- bytes , err := g .cl .Get ().AbsPath ("/openid/v1/jwks" ).Do (ctx ). Raw ( )
113- if err != nil {
113+ result := g .cl .Get ().AbsPath ("/openid/v1/jwks" ).Do (ctx )
114+ if err := result . Error (); err != nil {
114115 return nil , fmt .Errorf ("failed to get JWKS from jwks_uri: %s" , k8sErrorMessage (err ))
115116 }
116117
118+ bytes , _ := result .Raw ()
117119 var jwksResponse map [string ]any
118120 if err := json .Unmarshal (bytes , & jwksResponse ); err != nil {
119121 return nil , fmt .Errorf ("failed to unmarshal JWKS response: %v" , err )
0 commit comments