1/** 2 * Construct a URL that points to the SSO start endpoint and append redirect_to / idp_id. 3 * 4 * PHP passes window.wpo365.ssoStartUrl which is permalink-aware: 5 * - pretty permalinks â <site url>/wpo/sso/start 6 * - plain permalinks â <site url>/?wpo_sso_start=1 7 * 8 * A legacy fallback derives the pretty URL from window.wpo365.siteUrl for 9 * older builds that do not yet pass ssoStartUrl. 10 */ 11 12function getWpoSsoUrl() { 13 window.wpo365 = window.wpo365 || {}; 14 var wpoSsoStartUrl = window.wpo365.ssoStartUrl; 15 16 if (!wpoSsoStartUrl) { 17 // Legacy fallback: derive the pretty-permalink form from siteUrl. 18 var wpoSiteUrl = (window.wpo365.siteUrl || '').replace(/\/$/, ''); 19 20 if (!wpoSiteUrl) { 21 console.error('wpoSsoButton: Unexpected error occurred -> ssoStartUrl and siteUrl are both null or empty.'); 22 } 23 24 wpoSsoStartUrl = wpoSiteUrl + '/wpo/sso/start'; 25 } 26 27 var wpoRedirectTo = new URLSearchParams(window.location.search).get('redirect_to') || location.href; 28 var separator = wpoSsoStartUrl.indexOf('?') === -1 ? '?' : '&'; 29 var wpoSsoUrl = wpoSsoStartUrl + separator + 'redirect_to=' + encodeURIComponent(wpoRedirectTo); 30 31 if (!!document.getElementById('selectedTenant')) { 32 wpoSsoUrl = wpoSsoUrl + '&idp_id=' + document.getElementById('selectedTenant').value; 33 } 34 return wpoSsoUrl; 35}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.