fix: respect retry in token introspection
@@ -172,7 +172,17 @@ func (a *AuthenticatorOAuth2Introspection) Config(config json.RawMessage) (*Auth
return nil, NewErrAuthenticatorMisconfigured(a, err)
}
+ var rt http.RoundTripper
+
if c.PreAuth != nil && c.PreAuth.Enabled {
+ rt = (&clientcredentials.Config{
+ ClientID: c.PreAuth.ClientID,
+ ClientSecret: c.PreAuth.ClientSecret,
+ Scopes: c.PreAuth.Scope,
+ TokenURL: c.PreAuth.TokenURL,
+ }).Client(context.Background()).Transport
+ }
+
if c.Retry == nil {
c.Retry = &AuthenticatorOAuth2IntrospectionRetryConfiguration{Timeout: "500ms", MaxWait: "1s"}
} else {
@@ -194,19 +204,7 @@ func (a *AuthenticatorOAuth2Introspection) Config(config json.RawMessage) (*Auth
return nil, err
}
- a.client = httpx.NewResilientClientLatencyToleranceConfigurable(
- (&clientcredentials.Config{
- ClientID: c.PreAuth.ClientID,
- ClientSecret: c.PreAuth.ClientSecret,
- Scopes: c.PreAuth.Scope,
- TokenURL: c.PreAuth.TokenURL,
- }).
- Client(context.Background()).
- Transport,
- timeout,
- maxWait,
- )
- }
+ a.client = httpx.NewResilientClientLatencyToleranceConfigurable(rt, timeout, maxWait)
return &c, nil
}
