| 215 | } |
| 216 | |
| 217 | func (opm OIDCProviderMap) GetProviderForIssuer(ctx context.Context, issuer string, audiences []string) *OIDCProvider { |
| 218 | base.DebugfCtx(ctx, base.KeyAuth, "GetProviderForIssuer with issuer: %v, audiences: %+v", base.UD(issuer), base.UD(audiences)) |
| 219 | for _, provider := range opm { |
| 220 | clientID := base.ValDefault(provider.ClientID, "") |
| 221 | if provider.Issuer == issuer && clientID != "" { |
| 222 | // Iterate over the audiences looking for a match |
| 223 | for _, aud := range audiences { |
| 224 | if clientID == aud { |
| 225 | base.DebugfCtx(ctx, base.KeyAuth, "Provider matches, returning") |
| 226 | return provider |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | base.InfofCtx(ctx, base.KeyAuth, "No provider match found") |
| 232 | return nil |
| 233 | } |
| 234 | |
| 235 | // Stop stops all the provider discovery sync task by terminating the async goroutines. |
| 236 | func (opm OIDCProviderMap) Stop() { |