mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #3929 from DSpace/backport-3912-to-dspace-7_x
[Port dspace-7_x] Fix auth in UI with LDAP if password authentication is disabled
This commit is contained in:
@@ -116,12 +116,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);
|
||||
|
Reference in New Issue
Block a user