Skip to content

Commit 04e3414

Browse files
authored
Merge pull request #3930 from DSpace/backport-3912-to-dspace-8_x
[Port dspace-8_x] Fix auth in UI with LDAP if password authentication is disabled
2 parents 64c6c19 + 33d2a43 commit 04e3414

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,24 @@ export class AuthInterceptor implements HttpInterceptor {
129129
*/
130130
private sortAuthMethods(authMethodModels: AuthMethod[]): AuthMethod[] {
131131
const sortedAuthMethodModels: AuthMethod[] = [];
132+
let passwordAuthFound = false;
133+
let ldapAuthFound = false;
134+
132135
authMethodModels.forEach((method) => {
133136
if (method.authMethodType === AuthMethodType.Password) {
134137
sortedAuthMethodModels.push(method);
138+
passwordAuthFound = true;
139+
}
140+
if (method.authMethodType === AuthMethodType.Ldap) {
141+
ldapAuthFound = true;
135142
}
136143
});
137144

145+
// Using password authentication method to provide UI for LDAP authentication even if password auth is not present in server
146+
if (ldapAuthFound && !(passwordAuthFound)) {
147+
sortedAuthMethodModels.push(new AuthMethod(AuthMethodType.Password,0));
148+
}
149+
138150
authMethodModels.forEach((method) => {
139151
if (method.authMethodType !== AuthMethodType.Password) {
140152
sortedAuthMethodModels.push(method);

0 commit comments

Comments
 (0)