webui: prevent infinite reload for users with krbbprincipal alias set

Web UI has inbuilt mechanism to reload in case response from a server
contains a different principal than the one loaded during Web UI
startup.

see rpc.js:381

With kerberos aliases support the loaded principal could be different
because krbprincipalname contained multiple values.

In such case krbcanonicalname should be used - it contains the same
principal as the one which will be in future API responses.

https://fedorahosted.org/freeipa/ticket/5927

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Petr Vobornik 2016-06-30 19:16:32 +02:00 committed by Martin Basti
parent f5eb71f75e
commit 88f7154f7f

View File

@ -259,7 +259,11 @@ var IPA = function () {
},
on_success: function(data, text_status, xhr) {
that.whoami = batch ? data.result[0] : data.result.result[0];
that.principal = that.whoami.krbprincipalname[0];
var cn = that.whoami.krbcanonicalname;
if (cn) that.principal = cn[0];
if (!that.principal) {
that.principal = that.whoami.krbprincipalname[0];
}
}
});
};