SSO LDAP: Fix ldap provider in providers list (#93472)

* Correct comment about provider filter

* Add type for LDAP provider

* Ignore old LDAP init setup when using SSO
This commit is contained in:
linoman 2024-09-19 16:05:55 +02:00 committed by GitHub
parent 362ffff591
commit 63195664f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -52,9 +52,16 @@ export const AuthConfigPageUnconnected = ({
reportInteraction('authentication_ui_provider_clicked', { provider: providerType, enabled }); reportInteraction('authentication_ui_provider_clicked', { provider: providerType, enabled });
}; };
// filter out saml and ldap from sso providers because it is already included in availableProviders // filter out saml from sso providers because it is already included in availableProviders
providers = providers.filter((p) => p.provider !== 'saml'); providers = providers.filter((p) => p.provider !== 'saml');
providers = providers.map((p) => {
if (p.provider === 'ldap') {
p.settings.type = p.provider;
}
return p;
});
const providerList = availableProviders.length const providerList = availableProviders.length
? [ ? [
...availableProviders.map((p) => ({ ...availableProviders.map((p) => ({

View File

@ -1,3 +1,4 @@
import config from 'app/core/config';
import { contextSrv } from 'app/core/core'; import { contextSrv } from 'app/core/core';
import { getBackendSrv } from 'app/core/services/backend_srv'; import { getBackendSrv } from 'app/core/services/backend_srv';
import { AccessControlAction, Settings, SettingsSection } from 'app/types'; import { AccessControlAction, Settings, SettingsSection } from 'app/types';
@ -51,6 +52,11 @@ export async function getAuthProviderStatus(providerId: string): Promise<AuthPro
} }
export function initAuthConfig() { export function initAuthConfig() {
// skip the LDAP provider if it is enabled by SSO settings
if (config.featureToggles.ssoSettingsApi && config.featureToggles.ssoSettingsLDAP) {
return;
}
const ldapAuthProvider: AuthProviderInfo = { const ldapAuthProvider: AuthProviderInfo = {
id: 'ldap', id: 'ldap',
type: 'LDAP', type: 'LDAP',