-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathauth-redirect.js
More file actions
1 lines (1 loc) · 12.1 KB
/
Copy pathauth-redirect.js
File metadata and controls
1 lines (1 loc) · 12.1 KB
1
(function(P,u){typeof exports=="object"&&typeof module=="object"?module.exports=u():typeof define=="function"&&define.amd?define([],u):typeof exports=="object"?exports.GUI=u():P.GUI=u()})(self,()=>(()=>{"use strict";var U={};/*! @azure/msal-common v16.5.2 2026-04-28 */const P="msal.js.common",u="https://login.microsoftonline.com/common/",St="login.microsoftonline.com",At="common",Rt="adfs",dt="dstsv2",pt=".ciamlogin.com",mt=".onmicrosoft.com",Ct="9188040d-6c67-4c5b-b112-36a304b66dad",k="openid",G="profile",V="offline_access",K="email",Nt="authorization_code",It="S256",gt="application/x-www-form-urlencoded;charset=utf-8",ft="authorization_pending",Dt="Not Available",Pt="http://169.254.169.254/metadata/instance/compute/location",wt="2020-06-01",Ht="TryAutoDetect",Lt="login.microsoft.com",vt="invalid_instance",oe={GET:"GET",POST:"POST"},re=[...[k,G,V],K],ie={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},ce={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},w={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},ae={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},_e={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},Ee={PLAIN:"plain",S256:"S256"},Te={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},le={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},ue={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},Se="MSSTS",Ae="ADFS",Re="MSA",de="Generic",he="-",pe=".",me={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},Oe={ADFS:1001,MSA:1002,MSSTS:1003,GENERIC:1004,ACCESS_TOKEN:2001,REFRESH_TOKEN:2002,ID_TOKEN:2003,APP_METADATA:3001,UNDEFINED:9999},Ce="appmetadata",Ne="client_info",Ie="1",ge="authority-metadata",fe=null,ye={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},De=5,Ue=80,Pe=330,we=50,Me="server-telemetry",He="|",Le=",",Fe="1",be="0",ve="unknown_error",ke={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},Ge=60,Ve=3600,Ke="throttling",We="retry-after, h429",Ye="invalid_grant",qe="client_mismatch",xe={username:"username",password:"password"},$e={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},Be={CONFIGURED_MATCHES_DETECTED:"1",CONFIGURED_NO_AUTO_DETECTION:"2",CONFIGURED_NOT_DETECTED:"3",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},je={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Qe={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},Xe=864e5,Je=300,ze={BASE64:"base64",HEX:"hex",UTF8:"utf-8"};/*! @azure/msal-common v16.5.2 2026-04-28 */function M(n){return`See https://aka.ms/msal.js.errors#${n} for details`}class E extends Error{constructor(t,e,o){const s=e||(t?M(t):""),r=s?`${t}: ${s}`:t;super(r),Object.setPrototypeOf(this,E.prototype),this.errorCode=t||"",this.errorMessage=s||"",this.subError=o||"",this.name="AuthError"}setCorrelationId(t){this.correlationId=t}}function Ze(n,t){return new E(n,t||M(n))}/*! @azure/msal-common v16.5.2 2026-04-28 */class m extends E{constructor(t,e){super(t,e),this.name="ClientAuthError",Object.setPrototypeOf(this,m.prototype)}}function O(n,t){return new m(n,t)}/*! @azure/msal-common v16.5.2 2026-04-28 */const tn="client_info_decoding_error",en="client_info_empty_error",nn="token_parsing_error",on="null_or_empty_token",sn="endpoints_resolution_error",rn="network_error",cn="openid_config_error",an="hash_not_deserialized",H="invalid_state",_n="state_mismatch",En="state_not_found",Tn="nonce_mismatch",ln="auth_time_not_found",un="max_age_transpired",Sn="multiple_matching_tokens",An="multiple_matching_appMetadata",Rn="request_cannot_be_made",dn="cannot_remove_empty_scope",hn="cannot_append_scopeset",pn="empty_input_scopeset",mn="no_account_in_silent_request",On="invalid_cache_record",Cn="invalid_cache_environment",Nn="no_account_found",W="no_crypto_object",In="unexpected_credential_type",gn="token_refresh_required",fn="token_claims_cnf_required_for_signedjwt",yn="authorization_code_missing_from_server_response",Dn="binding_key_not_removed",Un="end_session_endpoint_not_supported",Pn="key_id_missing",wn="no_network_connectivity",Mn="user_canceled",Hn="method_not_implemented",Ln="nested_app_auth_bridge_disabled",Fn="platform_broker_error",bn="resource_parameter_required",vn="misplaced_resource_parameter";var Y,q,x;/*! @azure/msal-common v16.5.2 2026-04-28 */function kn(n,t,e){const o=$(n,e);return t?`${o}${Y}${t}`:o}function $(n,t){if(!n)throw q(x);const e={id:n.createNewGuid()};t&&(e.meta=t);const o=JSON.stringify(e);return n.base64Encode(o)}function B(n,t){if(!n)throw O(W);if(!t)throw O(H);try{const e=t.split("|"),o=e[0],s=e.length>1?e.slice(1).join("|"):"",r=n(o),a=JSON.parse(r);return{userRequestState:s||"",libraryState:a}}catch{throw O(H)}}/*! @azure/msal-common v16.5.2 2026-04-28 */class C extends E{constructor(t){super(t),this.name="ClientConfigurationError",Object.setPrototypeOf(this,C.prototype)}}function T(n){return new C(n)}/*! @azure/msal-common v16.5.2 2026-04-28 */class N{static isEmptyObj(t){if(t)try{const e=JSON.parse(t);return Object.keys(e).length===0}catch{}return!0}static startsWith(t,e){return t.indexOf(e)===0}static endsWith(t,e){return t.length>=e.length&&t.lastIndexOf(e)===t.length-e.length}static queryStringToObject(t){const e={},o=t.split("&"),s=r=>decodeURIComponent(r.replace(/\+/g," "));return o.forEach(r=>{if(r.trim()){const[a,l]=r.split(/=(.+)/g,2);a&&l&&(e[s(a)]=s(l))}}),e}static trimArrayEntries(t){return t.map(e=>e.trim())}static removeEmptyStringsFromArray(t){return t.filter(e=>!!e)}static jsonParseHelper(t){try{return JSON.parse(t)}catch{return null}}}/*! @azure/msal-common v16.5.2 2026-04-28 */const Gn="redirect_uri_empty",Vn="claims_request_parsing_error",j="authority_uri_insecure",R="url_parse_error",Q="empty_url_error",Kn="empty_input_scopes_error",Wn="invalid_claims",Yn="token_request_empty",qn="logout_request_empty",xn="invalid_code_challenge_method",$n="pkce_params_missing",Bn="invalid_cloud_discovery_metadata",jn="invalid_authority_metadata",Qn="untrusted_authority",Xn="missing_ssh_jwk",Jn="missing_ssh_kid",zn="missing_nonce_authentication_header",Zn="invalid_authentication_header",to="cannot_set_OIDCOptions",eo="cannot_allow_platform_broker",no="authority_mismatch",oo="invalid_request_method_for_EAR";/*! @azure/msal-common v16.5.2 2026-04-28 */class _{get urlString(){return this._urlString}constructor(t){if(this._urlString=t,!this._urlString)throw T(Q);t.includes("#")||(this._urlString=_.canonicalizeUri(t))}static canonicalizeUri(t){if(t){let e=t.toLowerCase();return N.endsWith(e,"?")?e=e.slice(0,-1):N.endsWith(e,"?/")&&(e=e.slice(0,-2)),N.endsWith(e,"/")||(e+="/"),e}return t}validateAsUri(){let t;try{t=this.getUrlComponents()}catch{throw T(R)}if(!t.HostNameAndPort||!t.PathSegments)throw T(R);if(!t.Protocol||t.Protocol.toLowerCase()!=="https:")throw T(j)}static appendQueryString(t,e){return e?t.indexOf("?")<0?`${t}?${e}`:`${t}&${e}`:t}static removeHashFromUrl(t){return _.canonicalizeUri(t.split("#")[0])}replaceTenantPath(t){const e=this.getUrlComponents(),o=e.PathSegments;return t&&o.length!==0&&(o[0]===w.COMMON||o[0]===w.ORGANIZATIONS)&&(o[0]=t),_.constructAuthorityUriFromObject(e)}getUrlComponents(){const t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),e=this.urlString.match(t);if(!e)throw T(R);const o={Protocol:e[1],HostNameAndPort:e[4],AbsolutePath:e[5],QueryString:e[7]};let s=o.AbsolutePath.split("/");return s=s.filter(r=>r&&r.length>0),o.PathSegments=s,o.QueryString&&o.QueryString.endsWith("/")&&(o.QueryString=o.QueryString.substring(0,o.QueryString.length-1)),o}static getDomainFromUrl(t){const e=RegExp("^([^:/?#]+://)?([^/?#]*)"),o=t.match(e);if(!o)throw T(R);return o[2]}static getAbsoluteUrl(t,e){if(t[0]==="/"){const s=new _(e).getUrlComponents();return s.Protocol+"//"+s.HostNameAndPort+t}return t}static constructAuthorityUriFromObject(t){return new _(t.Protocol+"//"+t.HostNameAndPort+"/"+t.PathSegments.join("/"))}}/*! @azure/msal-browser v5.9.0 2026-04-28 */function X(n){return`See https://aka.ms/msal.js.errors#${n} for details`}class I extends E{constructor(t,e){super(t,X(t),e),Object.setPrototypeOf(this,I.prototype),this.name="BrowserAuthError"}}function S(n,t){return new I(n,t)}/*! @azure/msal-browser v5.9.0 2026-04-28 */const J="no_state_in_hash",z="unable_to_parse_state",Z="invalid_base64_string",tt="timed_out",et="empty_response";/*! @azure/msal-browser v5.9.0 2026-04-28 */function nt(n){return new TextDecoder().decode(ot(n))}function ot(n){let t=n.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw S(Z)}const e=atob(t);return Uint8Array.from(e,o=>o.codePointAt(0)||0)}/*! @azure/msal-browser v5.9.0 2026-04-28 */function st(){const n=window.location.hash,t=window.location.search;let e=!1,o=!1,s="",r;if(n&&n.length>1){const c=n.charAt(0)==="#"?n.substring(1):n,i=new URLSearchParams(c);i.has("state")&&(e=!0,s=c,r=i)}if(t&&t.length>1){const c=t.charAt(0)==="?"?t.substring(1):t,i=new URLSearchParams(c);i.has("state")&&(o=!0,s=c,r=i)}if(e&&o){const c=t.charAt(0)==="?"?t.substring(1):t,i=n.charAt(0)==="#"?n.substring(1):n;s=`${c}${i}`,r=new URLSearchParams(s)}if(!s||!r)throw S(et);const a=r.get("state");if(!a)throw S(J);const{libraryState:l}=B(nt,a),{id:h,meta:p}=l;if(!h||!p)throw S(z,"missing_library_state");return{params:r,payload:s,urlHash:n,urlQuery:t,hasResponseInHash:e,hasResponseInQuery:o,libraryState:{id:h,meta:p}}}function rt(){const t=new _(window.location.href).getUrlComponents();return`${t.Protocol}//${t.HostNameAndPort}/`}/*! @azure/msal-browser v5.9.0 2026-04-28 */const it={SIGNOUT:"signout"},g={ORIGIN_URI:"request.origin",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",VERIFIER:"code.verifier",INTERACTION_STATUS_KEY:"interaction.status",NATIVE_REQUEST:"request.native"},L={handleRedirectPromise:865,logout:961};var f;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(f||(f={}));/*! @azure/msal-browser v5.9.0 2026-04-28 */const ct=3e4;/*! @azure/msal-browser v5.9.0 2026-04-28 */class d{navigateInternal(t,e){return d.defaultNavigateWindow(t,e)}navigateExternal(t,e){return d.defaultNavigateWindow(t,e)}static defaultNavigateWindow(t,e){return e.noHistory?window.location.replace(t):window.location.assign(t),new Promise((o,s)=>{setTimeout(()=>{s(S(tt,"failed_to_redirect"))},e.timeout)})}}/*! @azure/msal-browser v5.9.0 2026-04-28 */const y="msal";/*! @azure/msal-browser v5.9.0 2026-04-28 */async function at(n){let t;try{t=st()}catch(i){throw typeof window.history.replaceState=="function"&&window.history.replaceState(null,"",`${window.location.origin}${window.location.pathname}`),i}const{payload:e,urlHash:o,urlQuery:s,hasResponseInHash:r,hasResponseInQuery:a,libraryState:l}=t,{id:h,meta:p}=l;if(p.interactionType===f.Redirect){const i=n||new d;let F="",A="",b="";const _t=`${y}.${g.INTERACTION_STATUS_KEY}`;try{const lt=window.sessionStorage.getItem(_t),v=JSON.parse(lt||"");if(A=v.clientId||"",b=v.type,A){const ut=`${y}.${A}.${g.ORIGIN_URI}`;F=window.sessionStorage.getItem(ut)||""}}catch{}const Et={apiId:b===it.SIGNOUT?L.logout:L.handleRedirectPromise,noHistory:!0,timeout:ct};if(A)try{window.sessionStorage.setItem(`${y}.${A}.${g.URL_HASH}`,e)}catch{}const D=F||rt(),Tt=D.endsWith("?")?D.slice(0,-1):D;await i.navigateInternal(Tt,Et);return}if(typeof window.history.replaceState=="function"){let i=`${window.location.origin}${window.location.pathname}`;!r&&o&&(i+=o),!a&&s&&(i+=s),window.history.replaceState(null,"",i)}const c=new BroadcastChannel(h);c.postMessage({v:1,payload:e}),c.close();try{window.close()}catch{}}return(async()=>{try{await at()}catch{console.error("[auth-redirect] broadcastResponseToMainFrame failed")}})(),U})());