Skip to content

Commit 0abbf80

Browse files
authored
Merge pull request DSpace#3929 from DSpace/backport-3912-to-dspace-7_x
[Port dspace-7_x] Fix auth in UI with LDAP if password authentication is disabled
2 parents 6b73c75 + d4536ff commit 0abbf80

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,24 @@ export class AuthInterceptor implements HttpInterceptor {
116116
*/
117117
private sortAuthMethods(authMethodModels: AuthMethod[]): AuthMethod[] {
118118
const sortedAuthMethodModels: AuthMethod[] = [];
119+
let passwordAuthFound = false;
120+
let ldapAuthFound = false;
121+
119122
authMethodModels.forEach((method) => {
120123
if (method.authMethodType === AuthMethodType.Password) {
121124
sortedAuthMethodModels.push(method);
125+
passwordAuthFound = true;
126+
}
127+
if (method.authMethodType === AuthMethodType.Ldap) {
128+
ldapAuthFound = true;
122129
}
123130
});
124131

132+
// Using password authentication method to provide UI for LDAP authentication even if password auth is not present in server
133+
if (ldapAuthFound && !(passwordAuthFound)) {
134+
sortedAuthMethodModels.push(new AuthMethod(AuthMethodType.Password,0));
135+
}
136+
125137
authMethodModels.forEach((method) => {
126138
if (method.authMethodType !== AuthMethodType.Password) {
127139
sortedAuthMethodModels.push(method);

0 commit comments

Comments
 (0)