We use a once block to set up the OIDC client in the middleware:
|
var initErr error |
|
h.oidcClientInit.Do(func() { |
|
h.oidcClient, initErr = oidc.DiscoverClient(ctx, h.Issuer, h.ClientID, h.ClientSecret, h.RedirectURL) |
|
}) |
|
if initErr != nil { |
|
return nil, initErr |
|
} |
If the discovery fails, this will return an error and never attempt to initialise the client again. We should always try and initialise until we have a functioning client.
We use a once block to set up the OIDC client in the middleware:
oidc/middleware/middleware.go
Lines 268 to 274 in f864530
If the discovery fails, this will return an error and never attempt to initialise the client again. We should always try and initialise until we have a functioning client.