Skip to content

Commit

Permalink
Ensure that password authentication dialog is shown even if only ldap…
Browse files Browse the repository at this point in the history
… auth method is present
  • Loading branch information
minurmin committed Jan 28, 2025
1 parent 84feea9 commit 83d86d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/core/auth/auth.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,24 @@ export class AuthInterceptor implements HttpInterceptor {
*/
private sortAuthMethods(authMethodModels: AuthMethod[]): AuthMethod[] {
const sortedAuthMethodModels: AuthMethod[] = [];
let passwordAuthFound = false;
let ldapAuthFound = false;

Check warning on line 133 in src/app/core/auth/auth.interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/app/core/auth/auth.interceptor.ts#L132-L133

Added lines #L132 - L133 were not covered by tests

authMethodModels.forEach((method) => {
if (method.authMethodType === AuthMethodType.Password) {
sortedAuthMethodModels.push(method);
passwordAuthFound = true;

Check warning on line 138 in src/app/core/auth/auth.interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/app/core/auth/auth.interceptor.ts#L138

Added line #L138 was not covered by tests
}
if (method.authMethodType === AuthMethodType.Ldap) {
ldapAuthFound = true;

Check warning on line 141 in src/app/core/auth/auth.interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/app/core/auth/auth.interceptor.ts#L141

Added line #L141 was not covered by tests
}
});

// 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));

Check warning on line 147 in src/app/core/auth/auth.interceptor.ts

View check run for this annotation

Codecov / codecov/patch

src/app/core/auth/auth.interceptor.ts#L147

Added line #L147 was not covered by tests
}

authMethodModels.forEach((method) => {
if (method.authMethodType !== AuthMethodType.Password) {
sortedAuthMethodModels.push(method);
Expand Down

0 comments on commit 83d86d7

Please sign in to comment.