PageSourceSearch

https://www.openstack.org/component---node-modules-openstack-dev-g…e-src-pages-auth-js-bba5b066380c0d2c6796.js

js openstack.org collected 2026-10-01 08:05:05 UTC 29,715 bytes, 2 lines download raw bytes

1(self.webpackChunk_openstack_dev_marketing_site=self.webpackChunk_openstack_dev_marketing_site||[]).push([[468],{1023:function(e,t,o){e.exports=(()=>{"use strict";var e={5812:e=>{e.exports=o(4743)},8041:e=>{e.exports=o(4193)}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};n.r(r),n.d(r,{arraysEqual:()=>N,base64URLEncode:()=>x,buildAPIBaseUrl:()=>m,convertSVGtoImg:()=>D,epochToMoment:()=>d,epochToMomentTimeZone:()=>u,findElementPos:()=>c,formatEpoch:()=>p,getAllowedUserGroups:()=>O,getAuthCallback:()=>h,getBackURL:()=>w,getCurrentHref:()=>y,getCurrentLocation:()=>S,getCurrentPathName:()=>R,getCurrentUserLanguage:()=>I,getEventHosts:()=>F,getEventLocation:()=>M,getFromLocalStorage:()=>k,getOrigin:()=>E,getTimeServiceUrl:()=>H,hasErrors:()=>L,isClearingSessionState:()=>v,isEmpty:()=>C,objectToQueryString:()=>g,parseLocationHour:()=>_,putOnLocalStorage:()=>T,removeFromLocalStorage:()=>U,retryPromise:()=>j,scrollToError:()=>b,setSessionClearingState:()=>A,shallowEqual:()=>P,toSlug:()=>f});var a=n(5812),i=n.n(a),s=n(8041),l=n.n(s);const c=e=>{var t=-70;if(e.offsetParent){do{t+=e.offsetTop}while(e=e.offsetParent);return[t]}},d=e=>e?(e*=1e3,i()(e)):e,u=(e,t)=>e?(e*=1e3,i()(e).tz(t)):e,p=(e,t="M/D/YYYY h:mm a")=>e?d(e).format(t):e,_=e=>{let t=e.toString();return t.length<4&&(t=`0${t}`),t=t.match(/.{2}/g),t=t.join(":"),t},g=e=>{var t="";for(var o in e)""!=t&&(t+="&"),t+=o+"="+encodeURIComponent(e[o]);return t},w=()=>{let e=l()(window.location.href),t=e.search(!0),o=e.fragment(),n=t.hasOwnProperty("BackUrl")?t.BackUrl:null;return null!=n&&null!=o&&""!=o&&(n+=`#${o}`),n},f=e=>(e=e.toLowerCase()).replace(/[^a-zA-Z0-9]+/g,"_"),h=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,S=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},E=()=>"undefined"!=typeof window?window.location.origin:null,R=()=>"undefined"!=typeof window?window.location.pathname:null,y=()=>"undefined"!=typeof window?window.location.href:null,O=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,m=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,T=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},k=(e,t)=>{if("undefined"!=typeof window){let o=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),U(e)),o}return null},U=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},v=()=>"undefined"!=typeof window&&window.clearing_session_state,A=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},I=()=>{let e="en";return"undefined"!=typeof navigator&&(e=navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage),e},b=e=>{if(Object.keys(e).length>0){const t=Object.keys(e)[0],o=document.getElementById(t);o&&window.scrollTo(0,c(o))}},L=(e,t)=>e in t?t[e]:"",P=(e,t)=>{const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let r of o)if(e[r]!==t[r])return!1;return!0},N=(e,t)=>e.length===t.length&&e.every((e,o)=>P(e,t[o])),C=e=>0===Object.keys(e).length,x=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),j=async(e,t=3)=>{for(let o=0;o<t;o++)if(await e())return!0;return!1},H=()=>"undefined"!=typeof window?window.TIMEINTERVALSINCE1970_API_URL||{}.TIMEINTERVALSINCE1970_API_URL:null,M=(e,t,o=null,n=null)=>{var r,a;const i=!o||!n||1e3*o<n,s=[],{location:l}=e;return i&&l?(t>1&&null!==(r=l.venue)&&void 0!==r&&r.name&&s.push(l.venue.name),null!==(a=l.floor)&&void 0!==a&&a.name&&s.push(l.floor.name),l.name&&s.push(l.name),s.length>0?s.join(" - "):"TBA"):"TBA"},F=e=>{var t;let o=[];return(null===(t=e.speakers)||void 0===t?void 0:t.length)>0&&(o=[...e.speakers]),e.moderator&&o.push(e.moderator),o},D=async e=>{const t=await(async e=>{const t=document.createElement("img");return t.src=e,t.crossOrigin="anonymous",new Promise((e,o)=>{t.onload=()=>e(t),t.onerror=o})}
1)(e),o=100,n=Math.floor(100*t.naturalHeight/t.naturalWidth),r=document.createElement("canvas");r.width=o,r.height=n,r.getContext("2d").drawImage(t,0,0,o,n);const a=await r.toDataURL("image/png",1);return console.log(a,o,n),{url:a,width:o,height:n}};return r})()},4185:function(e,t,o){var n=o(8287).hp;e.exports=(()=>{"use strict";var e={5097:(e,t,o)=>{o.r(t),o.d(t,{CLEAR_SESSION_STATE:()=>f,LOGOUT_USER:()=>_,RECEIVE_USER_INFO:()=>w,REQUEST_USER_INFO:()=>g,SESSION_STATE_STATUS_CHANGED:()=>E,SESSION_STATE_STATUS_ERROR:()=>R,SESSION_STATE_STATUS_UNCHANGED:()=>S,SET_LOGGED_USER:()=>p,UPDATE_SESSION_STATE_STATUS:()=>h,UPDATE_USER_INFO:()=>y,doLogout:()=>m,getUserInfo:()=>T,onUserAuth:()=>O,updateSessionStateStatus:()=>U,updateUserInfo:()=>k});var n=o(1116),r=o.n(n),a=o(6842),i=o.n(a),s=o(9087),l=o(9558),c=o(1742);function d(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?d(Object(o),!0).forEach(function(t){r()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}const p="SET_LOGGED_USER",_="LOGOUT_USER",g="REQUEST_USER_INFO",w="RECEIVE_USER_INFO",f="CLEAR_SESSION_STATE",h="UPDATE_SESSION_STATE_STATUS",S="unchanged",E="changed",R="error",y="UPDATE_USER_INFO",O=(e,t,o,n=0,r=null)=>a=>{(0,c.storeAuthInfo)(e,n,r,t),a({type:p,payload:{sessionState:o}})},m=e=>(t,o)=>{t({type:_,payload:{backUrl:e}})},T=(e="groups",t="",o=null,n=null,r=null)=>async(a,d)=>{let u=(0,l.getAllowedUserGroups)();u=""!==u?u.split(" "):[];let{loggedUserState:p}=d(),{member:_}=p,f=await(0,c.getAccessToken)();if(null!=_)return null!=n&&null!=o&&n.push(o),Promise.resolve();null==r&&(r=s.authErrorHandler),a((0,s.startLoading)());let h={access_token:f,expand:e};return t&&(h.fields=t),(0,s.getRequest)((0,s.createAction)(g),(0,s.createAction)(w),(0,l.buildAPIBaseUrl)("/api/v1/members/me"),r)(h)(a,d).then(()=>{a((0,s.stopLoading)());let{member:e}=d().loggedUserState;if(null==e){let e={title:"ERROR",html:i().translate("errors.user_not_set"),type:"error"};a((0,s.showMessage)(e,c.initLogOut))}if(u.length>0&&0===e.groups.filter((e,t)=>u.includes(e.code)).length){let e={title:"ERROR",html:i().translate("errors.user_not_authz"),type:"error"};return void a((0,s.showMessage)(e,c.initLogOut))}null!=n&&null!=o&&n.push(o)})},k=e=>(t,o)=>{let{loggedUserState:n}=o(),{member:r}=n;if(null==r)throw Error("Member is not set.");if(e.id!=r.id)throw Error("Member is not the same.");t({type:y,payload:u({},e)})},U=e=>(t,o)=>{t({type:h,payload:{sessionStateStatus:e}})}},3195:(e,t,o)=>{o.d(t,{AUTH_ERROR_ACCESS_TOKEN_EXPIRED:()=>a,AUTH_ERROR_LOCK_ACQUIRE_ERROR:()=>i,AUTH_ERROR_MISSING_AUTH_INFO:()=>n,AUTH_ERROR_MISSING_REFRESH_TOKEN:()=>r,AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR:()=>s});const n="AUTH_ERROR_MISSING_AUTH_INFO",r="AUTH_ERROR_MISSING_REFRESH_TOKEN",a="AUTH_ERROR_ACCESS_TOKEN_EXPIRED",i="AUTH_ERROR_LOCK_ACQUIRE_ERROR",s="AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR"},1742:(e,t,r)=>{r.d(t,{doLogin:()=>P,getAccessToken:()=>x,initLogOut:()=>Q,storeAuthInfo:()=>H});var i=r(9558),s=r(5812),l=r.n(s);r(806);const c=o(7766);var d=r.n(c);const u=o(2733);var p=r.n(u),_=r(8041),g=r.n(_);r(9891),r(5097);const w=o(3009);var f=r.n(w);const h=o(4725);var S=r.n(h);const E=o(9956);var R=r.n(E);const y=65536,O="undefined"!=typeof window?window.crypto||window.msCrypto:null;var m=r(3195);const T=new(d()),k="openstackuicore.lock.getTokenSilently",U="code",v="authInfo",A="nonce",I="pkce",b="idToken",L=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o="";for(let n=0;n<e;n++)o+=t.charAt(Math.floor(62*Math.random()));return o},P=(e=null,t=null,o=null,n=null,r=null)=>{let a=((e=null,t=null,o=null,n=null,r=null,a=null)=>{let s=$(),l=(0,i.getAuthCallback)(),c=K(),d=q(),u=G();null!=e&&(l+=`?BackUrl=${encodeURI(e)}`);let p=L(16);(0,i.putOnLocalStorage)(A,p);let _=g()(`${c}/oauth2/auth`),w={response_type:encodeURI(u),scope:encodeURI(d),nonce:p,response_mode:"fragment",client_id:encodeURI(s),redirect_uri:encodeURI(l)};if(u===U){const e=N();(0,i.putOnLocalStorage)(I,JSON.stringify(e)),w.code_challenge=e.codeChallenge,w.code_challenge_method="S256",w.approval_prompt="force"}return t&&(w.prompt=t),d&&d.includes("offline_access")&&(w.prompt="consent"),o&&(w.id_token_hint=o),n&&(w.provider=n),a&&(w.otp_login_hint=a),r&&(w.login_hint=encodeURI(r)),_=_.query(w),_})(e,o,null,t,n,r);(0,i.getCurrentLocation)().replace(a.toString())},N=()=>{const e=(0,i.base64URLEncode)((e=>{if(e>4294967295)throw new RangeError("requested too many random bytes");const t=n.allocUnsafe(e);if(!O)return a;
1if(e>0)if(e>y)for(let o=0;o<e;o+=y)O.getRandomValues(t.slice(o,o+y));else O.getRandomValues(t);return t})(64));return{codeVerifier:e,codeChallenge:((e,t="hex")=>{let o=R();return"Base64url"===t&&(o=S()),f()(e).toString(o)})(e,"Base64url"),createdAt:new Date}},C=async()=>{console.log("openstack-uicore-foundation::Security::methods::_getAccessToken");let e=M();if(!e)throw console.log("openstack-uicore-foundation::Security::methods::_getAccessToken AUTH_ERROR_MISSING_AUTH_INFO"),Error(m.AUTH_ERROR_MISSING_AUTH_INFO);let{accessToken:t,expiresIn:o,accessTokenUpdatedAt:n,refreshToken:r}=e,a=G();const i=l()().unix();let s=i-n;return o-=60,console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken now ${i} accessTokenUpdatedAt ${n} expiresIn ${o} timeElapsedSecs ${s}`),(s>=o||null==t)&&(console.log("openstack-uicore-foundation::Security::methods::_getAccessToken  access token expired, refreshing it ..."),t=await(async(e,t)=>{if(e===U&&B()){if(!t)throw F(),Error(m.AUTH_ERROR_MISSING_REFRESH_TOKEN);let e=await j(t),{access_token:o,expires_in:n,refresh_token:r,id_token:a}=e;return void 0===r&&(r=null),H(o,n,r,a),o}throw F(),Error(m.AUTH_ERROR_ACCESS_TOKEN_EXPIRED)})(a,r)),t},x=async()=>{var e;if(null!==(e=navigator)&&void 0!==e&&e.locks)return await navigator.locks.request(k,async e=>(console.log("openstack-uicore-foundation::Security::methods::getAccessToken web lock api",e),await C()));if(!await(0,i.retryPromise)(()=>T.acquireLock(k,6e3),10))throw Error(m.AUTH_ERROR_LOCK_ACQUIRE_ERROR);try{return await C()}finally{await T.releaseLock(k)}},j=async e=>{let t=K(),o=$();const n={grant_type:"refresh_token",client_id:encodeURI(o),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then(e=>{if(400===e.status)throw(0,i.getCurrentPathName)(),(0,i.setSessionClearingState)(!0),Error(`${m.AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: ${e.status} - ${e.statusText}`);return e}).catch(function(e){throw Error(`${m.AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: ${e.message}`)}),o=await e.json();let{access_token:r,refresh_token:a,expires_in:s,id_token:l}=o;return{access_token:r,refresh_token:a,expires_in:s,id_token:l}}catch(e){throw console.log(e),e}},H=(e,t,o=null,n=null)=>{let r=M(),a={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null==o&&r&&(o=r.refreshToken),null==n&&r&&(n=r.idToken),o&&(a.refreshToken=o),n?(a[b]=n,p().set(b,n,{secure:!0,sameSite:"Lax"})):p().remove(b),(0,i.putOnLocalStorage)(v,JSON.stringify(a))},M=()=>{try{let e=(0,i.getFromLocalStorage)(v,!1);return e?JSON.parse(e):null}catch(e){return null}},F=()=>{"undefined"!=typeof window&&((0,i.removeFromLocalStorage)(v),p().remove(b))},D=()=>{if("undefined"!=typeof window){const e=M();return e?e.idToken:null}return null},$=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,G=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",B=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),K=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,q=()=>"undefined"!=typeof window?window.SCOPES:null,Q=()=>{(0,i.getCurrentLocation)().replace(((e=null)=>{let t=K(),o=$(),n=g()(`${t}/oauth2/end-session`),r=L(16),a=`${(0,i.getOrigin)()}/auth/logout`;(0,i.putOnLocalStorage)("post_logout_state",r);const s={post_logout_redirect_uri:encodeURI(a),client_id:encodeURI(o),state:r};return e&&(s.id_token_hint=e),n.query(s)})(D()).toString())}},9087:(e,t,o)=>{o.d(t,{authErrorHandler:()=>A,createAction:()=>S,getRequest:()=>I,showMessage:()=>C,startLoading:()=>E,stopLoading:()=>R});var n=o(2462),r=o.n(n),a=o(806),i=o.n(a),s=o(8041),l=o.n(s),c=o(9236),d=o.n(c),u=o(6842),p=o.n(u),_=o(9558),g=o(5097),w=o(1742);const f=["access_token"];let h=i();const S=e=>t=>({type:e,payload:t}),E=(S("RESET_LOADING"),S("START_LOADING")),R=S("STOP_LOADING"),y={},O={},m=e=>0===Object.keys(e).length&&e.constructor===Object,T=(e,t,o,n)=>({httpCode:e,title:t,html:o,type:n}),k=(e,t,o)=>T(e,t,o,"error"),U=(e,t,o)=>T(e,t,o,"warning"),v=()=>e=>{const t=(0,_.getCurrentPathName)(),o=(0,_.isClearingSessionState)();e({type:g.CLEAR_SESSION_STATE,payload:{}}),o||((0,_.setSessionClearingState)(!0),console.log("authErrorHandler 401 - re login"),(0,w.doLogin)(t))},A=(e,t,o=C)=>t=>{var n,r;const a=e.status;let i,s,l="";switch(t(R()),a){case 401:o!==C?(i=k(a,"ERROR",p().translate("errors.user_not_auth")),s=()=>t(v())):t(v());break;case 403:i=k(a,"ERROR",p().translate("errors.user_not_authz")),s=w.initLogOut;break;case 404:l=(null===(n=e.response.body)||void 0===n?void 0:n.message)||(null===(r=e.response.error)||void 0===r?void 0:r.message)||e.message,i=U(a,"Not Found",l);break;
1case 412:for(const[t,o]of Object.entries(e.response.body.errors))l+=isNaN(t)?`${t}: `:"",l+=`${o}<br>`;t({type:"VALIDATE",payload:{errors:e.response.body.errors}}),i=U(a,"Validation error",l);break;default:i=k(a,"ERROR",p().translate("errors.server_error"))}i&&t(o(i,s))},I=(e,t,o,n=b,a={},i=!1)=>(s={})=>(c,d)=>{let u=l()(o),p=u.toString();if(!m(s)){const{access_token:e}=s,t=r()(s,f);p=u.query(t).toString(),u=u.query(s)}return e&&"function"==typeof e&&c(e(a)),(e=>{y[e]&&(y[e].abort(),console.log(`aborted request ${e}`),delete y[e])})(p),new Promise((e,o)=>{let r=h.get(u.toString());if(i&&O.hasOwnProperty(p)){const{etag:e}=O[p];e&&r.set("If-None-Match",e)}r.timeout({response:6e4,deadline:6e4}).end(N(c,d,t,n,e,o,p,i)),((e,t)=>{y[e]=t})(p,r)})},b=(e,t)=>e=>{let o=t.body,n="";o instanceof Object&&o.hasOwnProperty("message")&&(n=o.message),d().fire(t.statusText,n,"error")},L=e=>e.toLowerCase(),P=(e,t={})=>{const o=(e=>Object.keys(e))(t).find((e=>t=>L(t)===e)(e));return o?t[o]:void 0},N=(e,t,o,n,r,a,i=null,s=!1)=>(l,c)=>{if(l||!c.ok){if(304===l.status&&O.hasOwnProperty(i)&&s){const{body:t}=O[i];return"function"==typeof o?(e(o({response:t})),r({response:t})):(e(o),r({response:t}))}return n&&n(l,c)(e,t),a({err:l,res:c,dispatch:e,state:t})}let d=c.body;if(s){const e=P("etag",c.headers);e&&(O[i]={etag:e,body:d})}return"function"==typeof o?(e(o({response:d})),r({response:d})):(e(o),r({response:d}))},C=(e,t=null)=>o=>{o(R()),d().fire(e).then(e=>{e.value&&"function"==typeof t&&t()})}},9558:(e,t,o)=>{o.d(t,{base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAllowedUserGroups:()=>s,getAuthCallback:()=>n,getCurrentLocation:()=>r,getCurrentPathName:()=>i,getFromLocalStorage:()=>d,getOrigin:()=>a,isClearingSessionState:()=>p,putOnLocalStorage:()=>c,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>_}),o(5812),o(8041);const n=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,r=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},a=()=>"undefined"!=typeof window?window.location.origin:null,i=()=>"undefined"!=typeof window?window.location.pathname:null,s=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,c=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let o=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),o}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=()=>"undefined"!=typeof window&&window.clearing_session_state,_=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),w=async(e,t=3)=>{for(let o=0;o<t;o++)if(await e())return!0;return!1}},1116:e=>{e.exports=o(3693)},2462:e=>{e.exports=o(1847)},6842:e=>{e.exports=o(2372)},9891:e=>{e.exports=o(5891)},5812:e=>{e.exports=o(4743)},806:e=>{e.exports=o(5734)},9236:e=>{e.exports=o(8465)},8041:e=>{e.exports=o(4193)}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(5097)})()},4500:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return m}});var n=o(6540),r=o(6462),a=o(1225),i=o(4185),s=o(2608),l=o(4810),c=o(2843),d=o(7106),u=o.n(d),p=o(4848);class _ extends(u()){constructor(e){super((0,c.mT)(c.K1),(0,c.mT)(c.Yn),e)}_callback(e){var t=e;t||(t="/"),this.props.getUserInfo("groups").then(()=>{(0,l.navigate)(t)})}_redirect2Error(e){return console.log("AuthorizationCallbackRoute error "+e),e.includes("access_de
1nied")||e.includes("consent_required")?(0,p.jsx)(r.Redirect,{to:"/",noThrow:!0}):(0,p.jsx)(r.Redirect,{to:"/error?error="+e,noThrow:!0})}render(){var{id_token_is_valid:e,error:t}=this.state;return null!=t?(console.log("AbstractAuthorizationCallbackRoute::render _redirect2Error error "+t),this._redirect2Error(t)):e?(0,p.jsx)("p",{children:"Checking Credentials..."}):this._redirect2Error("token_validation_error")}}var g=(0,a.Ng)(()=>({}),{})(_),w=o(4193),f=o.n(w),h=o(1023);class S extends n.Component{constructor(e){super(e),this.state={error:null,error_description:null}}componentDidMount(){var e,{location:t}=this.props,o=(0,h.getFromLocalStorage)("post_logout_state",!0);if(o){var n=f().parseQuery(t.search);if(n.hasOwnProperty("state")&&n.state===o){this.props.doLogout();var r=(0,h.getFromLocalStorage)("post_logout_redirect_path",!0);return void(0,l.navigate)(r||"/")}this.setState(Object.assign({},this.state,{error:"Invalid Nonce",error_description:"There was an error on logout process. Please try again."}))}else{var a=null!==(e=t.state)&&void 0!==e&&e.backUrl?t.state.backUrl:"/";window.localStorage.setItem("post_logout_redirect_path",a),(0,s.initLogOut)()}}render(){var{error:e,error_description:t}=this.state;return e?(0,p.jsx)(r.Redirect,{to:"/error?error="+e+"&error_description="+t,noThrow:!0}):null}}var E=(0,a.Ng)(null,{doLogout:i.doLogout})(S);class R extends n.Component{constructor(e){super(e),this.state={error:null}}componentWillMount(){var{doLogin:e,location:t}=this.props,o=f().parseQuery(t.search),n=null,r=null,a="/";o.login_hint&&(n=encodeURI(o.login_hint)),o.backUrl&&(a=encodeURI(o.backUrl)),o.otp_login_hint&&(r=encodeURI(o.otp_login_hint)),e(a,n,r)}render(){return null!=this.state.error?(0,p.jsx)("p",{children:this.state.error}):null}}var y=(0,a.Ng)(null)(R),O=class extends n.Component{render(){var{onUserAuth:e,doLogout:t,getUserInfo:o}=this.props;return(0,p.jsxs)(r.Router,{basepath:"/auth",children:[(0,p.jsx)(g,{onUserAuth:e,path:"/callback",getUserInfo:o}),(0,p.jsx)(E,{doLogout:t,path:"/logout"}),(0,p.jsx)(y,{doLogin:s.doLoginBasicLogin,path:"/login"})]})}},m=(0,a.Ng)(e=>{var{loggedUserState:t}=e;return{backUrl:t.backUrl}},{onUserAuth:i.onUserAuth,doLogout:i.doLogout,getUserInfo:i.getUserInfo})(O)},7106:function(e,t,o){var n,r=o(8287).hp;n=()=>(()=>{"use strict";var e={5097:(e,t,o)=>{o(1116),o(6842),o(9087),o(9558),o(1742)},3195:(e,t,o)=>{o.d(t,{AUTH_ERROR_MISSING_NONCE_PARAM:()=>r,AUTH_ERROR_MISSING_PKCE_PARAM:()=>n});const n="AUTH_ERROR_MISSING_PKCE_PARAM",r="AUTH_ERROR_MISSING_NONCE_PARAM"},1742:(e,t,n)=>{n.d(t,{RESPONSE_TYPE_CODE:()=>O,RESPONSE_TYPE_IMPLICIT:()=>y,doLogin:()=>k,emitAccessToken:()=>v,getOAuth2Flow:()=>I,validateIdToken:()=>P});var i=n(9558);n(5812),n(806);const s=o(7766);var l=n.n(s);o(2733);var c=n(8041),d=n.n(c),u=n(9891),p=n.n(u);n(5097);const _=o(3009);var g=n.n(_);const w=o(4725);var f=n.n(w);const h=o(9956);var S=n.n(h);const E="undefined"!=typeof window?window.crypto||window.msCrypto:null;var R=n(3195);new(l());const y="token id_token",O="code",m="nonce",T="pkce",k=(e=null,t=null,o=null,n=null,r=null)=>{let a=((e=null,t=null,o=null,n=null,r=null,a=null)=>{let s=A(),l=(0,i.getAuthCallback)(),c=b(),u=L(),p=I();null!=e&&(l+=`?BackUrl=${encodeURI(e)}`);let _=(e=>{let t="";for(let o=0;o<e;o++)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return t})(16);(0,i.putOnLocalStorage)(m,_);let g=d()(`${c}/oauth2/auth`),w={response_type:encodeURI(p),scope:encodeURI(u),nonce:_,response_mode:"fragment",client_id:encodeURI(s),redirect_uri:encodeURI(l)};if(p===O){const e=U();(0,i.putOnLocalStorage)(T,JSON.stringify(e)),w.code_challenge=e.codeChallenge,w.code_challenge_method="S256",w.approval_prompt="force"}return t&&(w.prompt=t),u&&u.includes("offline_access")&&(w.prompt="consent"),o&&(w.id_token_hint=o),n&&(w.provider=n),a&&(w.otp_login_hint=a),r&&(w.login_hint=encodeURI(r)),g=g.query(w),g})(e,o,null,t,n,r);(0,i.getCurrentLocation)().replace(a.toString())},U=()=>{const e=(0,i.base64URLEncode)((()=>{const e=r.allocUnsafe(64);return E?(E.getRandomValues(e),e):a})());return{codeVerifier:e,codeChallenge:((e,t="hex")=>{let o=S();return"Base64url"===t&&(o=f()),g()(e).toString(o)})(e,"Base64url"),createdAt:new Date}},v=async(e,t=null)=>{let o=b(),n=A(),r=(0,i.getAuthCallback)(),a=JSON.parse((0,i.getFromLocalStorage)(T,!0));if(!a)throw Error(R.AUTH_ERROR_MISSING_PKCE_PARAM);null!=t&&(r+=`?BackUrl=${encodeURI(t)}`);const s={code:e,grant_type:"authorization_code",code_verifier:a.codeVerifier,client_id:encodeURI(n),redirect_uri:encodeURI(r)};try{const e=await fetch(`${o}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)}).catch(function(e){console.log("Request failed:",e.message)}),t=await e.json();let{access_token:n,refresh_token:r,id_token:a,expires_in:i,error:l,error_description:c}=t;return{access_token:n,refresh_token:r,id_token:a,expires_in:i,error:l,error_description:c}}catch(e){console.log(e)}},A=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,I=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",b=()=>
1"undefined"!=typeof window?window.IDP_BASE_URL:null,L=()=>"undefined"!=typeof window?window.SCOPES:null,P=(e,t,o)=>{let n=new(p())({issuer:t,audience:o}),r=(0,i.getFromLocalStorage)(m,!0);if(!r)throw Error(R.AUTH_ERROR_MISSING_NONCE_PARAM);let a=n.decode(e),s=(a.header.alg,a.header.kid,a.payload.aud),l=a.payload.iss;return a.payload.exp,a.payload.nbf,(a.payload.nonce||null)==r&&s==o&&l==t}},9087:(e,t,o)=>{o(2462),o(806),o(8041),o(9236),o(6842),o(9558),o(5097),o(1742);const n=e=>t=>({type:e,payload:t});n("RESET_LOADING"),n("START_LOADING"),n("STOP_LOADING")},9558:(e,t,o)=>{o.d(t,{base64URLEncode:()=>d,getAuthCallback:()=>n,getCurrentHref:()=>i,getCurrentLocation:()=>r,getCurrentPathName:()=>a,getFromLocalStorage:()=>l,putOnLocalStorage:()=>s}),o(5812),o(8041);const n=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,r=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},a=()=>"undefined"!=typeof window?window.location.pathname:null,i=()=>"undefined"!=typeof window?window.location.href:null,s=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},l=(e,t)=>{if("undefined"!=typeof window){let o=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),o}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},d=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},1116:e=>{e.exports=o(3693)},2462:e=>{e.exports=o(1847)},6842:e=>{e.exports=o(2372)},9891:e=>{e.exports=o(5891)},5812:e=>{e.exports=o(4743)},806:e=>{e.exports=o(5734)},9236:e=>{e.exports=o(8465)},8041:e=>{e.exports=o(4193)}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{default:()=>S});var s=n(1116),l=n.n(s);const c=o(6540);var d=n.n(c),u=n(8041),p=n.n(u),_=n(1742),g=n(9558);function w(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function f(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?w(Object(o),!0).forEach(function(t){l()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):w(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}class h extends d().Component{constructor(e,t,o){super(o),this.state={id_token_is_valid:!0,error:null,error_description:null,issuer:e,audience:t,accessToken:null,flow:(0,_.getOAuth2Flow)()}}_implicitFlow(){const{access_token:e,id_token:t,session_state:o,error:n,error_description:r,expires_in:a}=this.extractHashParams();if(n)return void this.setState(f(f({},this.state),{},{error:n,error_description:r}));if(!e)return void(0,_.doLogin)((0,g.getCurrentPathName)());const i=!!t&&(0,_.validateIdToken)(t,this.state.issuer,this.state.audience);this.setState(f(f({},this.state),{},{id_token_is_valid:i,error:i?null:"Invalid Token",error_description:i?null:"Invalid Token",accessToken:e})),e&&i&&(this.props.onUserAuth(e,t,o,a),"undefined"!=typeof window&&window.location!==window.parent.location&&(console.log("AbstractAuthorizationCallbackRoute::_implicitFlow running inside iframe, sending auth state to parent"),window.parent.postMessage(JSON.stringify({action:"SET_AUTH_INFO_SILENTLY",access_token:e,id_token:t,session_state:o,expires_in:a}),window.location.origin)))}_codeFlow(){const{code:e,session_state:t,error:o,error_description:n}=this.extractHashParams();if(o)return void this.setState(f(f({},this.state),{},{error:o,error_description:n}));if(!e)return void(0,_.doLogin)((0,g.getCurrentPathName)());let r=p()((0,g.getCurrentHref)()).search(!0),a=r.hasOwnProperty("BackUrl")?r.BackUrl:null;(0,_.emitAccessToken)(e,a).then(e=>{let{id_token:r,access_token:a,refresh_token:i,expires_in:s,error:l,error_description:c}=e;if(l)return void this.setState(f(f({},this.state),{},{error:l,error_description:c}));const d=!!r&&(0,_.validateIdToken)(r,this.state.issuer,this.state.audience);this.setState(f(f({},this.state),{},{id_token_is_valid:d,accessToken:a,error:d?o:"Invalid Token",error_description:d?n:"Invalid Token"})),a&&d&&(this.props.onUserAuth(a,r,t,s,i),"undefined"!=typeof window&&window.location!==window.parent.location&&(console.log("AbstractAuthorizationCallbackRoute::_codeFlow running inside iframe, sending auth state to parent"),window.parent.postMessage(JSON.stringify({action:"SET_AUTH_INFO_SILENTLY",access_token:a,id_token:r,session_state:t,expires_in:s,refresh_token:i}),window.location.origin)))}).catch(e=>{console.log(e),(0,_.doLogin)((0,g.getCurrentPathName)())})}componentDidMount(){let{flow:e}=this.state;e!==_.RESPONSE_TYPE_IMPLICIT?e===_.RESPONSE_TYPE_CODE&&this._codeFlow():this._implicitFlow()}extractHashParams(){return p().parseQuery(this.props.location.hash.substr(1))}shouldComponentUpdate(e,t,o){return t.accessToken!==this.state.accessToken||t.error!==this.state.error||t.id_token_is_valid!==this.state.id_token_is_valid}componentDidUpdate(e,t,o){if(t.accessToken!==this.state.accessToken){let e=p()((0,g.getCurrentHref)()),t=e.search(!0),o=p().parseQuery(e.fragment());delete o.code,delete o.access_token,delete o.expires_in,delete o.token_type,delete o.scope,delete o.id_token,delete o.session_state;let n=t.hasOwnProperty("BackUrl")?t.BackUrl:"/app";o.lenght>0&&(n+=`#${p().buildQuery(o)}`),this._callback(n)}}_callback(e){}_redirect2Error(e){}render(){let{id_token_is_valid:e,error:t,error_description:o}=this.state;return null!=t?this._redirect2Error(`${t} - ${o}.`):e?null:this._redirect2Error("Token Validation Error - Token is invali
1d.")}}const S=h;return i})(),e.exports=n()}}]);
2//# sourceMappingURL=component---node-modules-openstack-dev-gatsby-theme-marketing-oif-core-src-pages-auth-js-bba5b066380c0d2c6796.js.map

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.