Improve Gateway authentication and static HTTP fidelity

This commit is contained in:
StasonJatham committed 2026-10-07 07:32:34 +02:00
1 parent 42561bfa34
commit 4ab9411aca
8 files changed
+167 -58

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
'use strict';
var _ctxstxt_CitrixCopyright = 'Copyright (c) Citrix Systems, Inc.';
window.CTXS = window.CTXS || {};
window.rdx = window.rdx || {};
rdx.base_view = function (element) { this.element = element; };
rdx.base_view.prototype.show = function () { if (this.element) this.element.hidden = false; };
rdx.base_view.prototype.hide = function () { if (this.element) this.element.hidden = true; };
rdx.utils = {
get_view: function (id) { return new rdx.base_view(document.getElementById(id || 'login-form')); },
authentication: function (xml) {
const document = new DOMParser().parseFromString(xml, 'application/xml');
const ns = 'http://citrix.com/authentication/response/1';
if (document.getElementsByTagName('parsererror').length ||
document.documentElement.localName !== 'AuthenticateResponse' ||
document.documentElement.namespaceURI !== ns) throw new Error('Invalid authentication response');
const text = name => document.getElementsByTagNameNS(ns, name)[0]?.textContent || '';
const errors = Array.from(document.getElementsByTagNameNS(ns, 'Label'))
.filter(label => label.getElementsByTagNameNS(ns, 'Type')[0]?.textContent === 'error')
.map(label => label.getElementsByTagNameNS(ns, 'Text')[0]?.textContent || '');
return { state: text('StateContext'), postback: text('PostBack'), errors };
}
};
CTXS.core = { getView: rdx.utils.get_view };