Ensure that password authentication dialog is shown even if only ldap auth method is present

(cherry picked from commit 83d86d7b68)
This commit is contained in:
Miika Nurminen
2025-01-28 23:41:30 +02:00
committed by github-actions[bot]
parent 64c6c19618
commit 33d2a43838

View File

@@ -129,12 +129,24 @@ export class AuthInterceptor implements HttpInterceptor {
*/
private sortAuthMethods(authMethodModels: AuthMethod[]): AuthMethod[] {
const sortedAuthMethodModels: AuthMethod[] = [];
let passwordAuthFound = false;
let ldapAuthFound = false;
authMethodModels.forEach((method) => {
if (method.authMethodType === AuthMethodType.Password) {
sortedAuthMethodModels.push(method);
passwordAuthFound = true;
}
if (method.authMethodType === AuthMethodType.Ldap) {
ldapAuthFound = true;
}
});
// Using password authentication method to provide UI for LDAP authentication even if password auth is not present in server
if (ldapAuthFound && !(passwordAuthFound)) {
sortedAuthMethodModels.push(new AuthMethod(AuthMethodType.Password,0));
}
authMethodModels.forEach((method) => {
if (method.authMethodType !== AuthMethodType.Password) {
sortedAuthMethodModels.push(method);