Skip unconnectable providers in provider listing
ConnectorProviderInfos listed every known provider, including ones this deployment cannot connect: no OAuth client credentials configured and no API-key or client-credentials fallback supported. Those rendered as dead entries the operator has no way to use, so skip them. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -549,6 +549,17 @@ func (r *organizationResolver) ConnectorProviderInfos(ctx context.Context, obj *
|
|||||||
|
|
||||||
for _, p := range coredata.ConnectorProviders() {
|
for _, p := range coredata.ConnectorProviders() {
|
||||||
_, oauthErr := r.connectorRegistry.Get(string(p))
|
_, oauthErr := r.connectorRegistry.Get(string(p))
|
||||||
|
oauthConfigured := oauthErr == nil
|
||||||
|
apiKeySupported := r.providerSupportsAPIKey(p)
|
||||||
|
clientCredentialsSupported := r.providerSupportsClientCredentials(p)
|
||||||
|
|
||||||
|
// Skip providers that cannot be connected in this deployment: no
|
||||||
|
// OAuth client credentials configured and no key-based fallback
|
||||||
|
// (API key or client credentials) supported. Surfacing them would
|
||||||
|
// render dead entries the operator has no way to use.
|
||||||
|
if !oauthConfigured && !apiKeySupported && !clientCredentialsSupported {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
scopes := r.providerRegistry.ProviderOAuth2Scopes(p)
|
scopes := r.providerRegistry.ProviderOAuth2Scopes(p)
|
||||||
if scopes == nil {
|
if scopes == nil {
|
||||||
@@ -558,9 +569,9 @@ func (r *organizationResolver) ConnectorProviderInfos(ctx context.Context, obj *
|
|||||||
info := &types.ConnectorProviderInfo{
|
info := &types.ConnectorProviderInfo{
|
||||||
Provider: p,
|
Provider: p,
|
||||||
DisplayName: r.providerDisplayName(p),
|
DisplayName: r.providerDisplayName(p),
|
||||||
OauthConfigured: oauthErr == nil,
|
OauthConfigured: oauthConfigured,
|
||||||
APIKeySupported: r.providerSupportsAPIKey(p),
|
APIKeySupported: apiKeySupported,
|
||||||
ClientCredentialsSupported: r.providerSupportsClientCredentials(p),
|
ClientCredentialsSupported: clientCredentialsSupported,
|
||||||
Oauth2Scopes: scopes,
|
Oauth2Scopes: scopes,
|
||||||
ExtraSettings: r.providerExtraSettings(p),
|
ExtraSettings: r.providerExtraSettings(p),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user