All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assets.3509.9bf1d89926b9972b5b0a.js Maven / Gradle / Ivy

There is a newer version: 1.6.0-rc1
Show newest version
/*! For license information please see 3509.9bf1d89926b9972b5b0a.js.LICENSE.txt */
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[3509],{13509:function(e,t,r){r.r(t),r.d(t,{NestedAppAuthController:function(){return T}});var n=r(13119),o=r(90177),s=r(26516),i=r(2979),c=r(5830),a=r(16468),u=r(26159),d=r(49279),p=r(24228),h=r(47752),l=r(76831),A=r(32111),g=r(85152),E=r(10536);class m{constructor(e,t,r,n){this.clientId=e,this.clientCapabilities=t,this.crypto=r,this.logger=n}toNaaTokenRequest(e){let t;t=void 0===e.extraQueryParameters?new Map:new Map(Object.entries(e.extraQueryParameters));const r=(new a.H).addClientCapabilitiesToClaims(e.claims,this.clientCapabilities);return{platformBrokerId:e.account?.homeAccountId,clientId:this.clientId,authority:e.authority,scope:e.scopes.join(" "),correlationId:void 0!==e.correlationId?e.correlationId:this.crypto.createNewGuid(),claims:u.x.isEmptyObj(r)?void 0:r,state:e.state,authenticationScheme:e.authenticationScheme||d.hO.BEARER,extraParameters:t}}fromNaaTokenResponse(e,t,r){if(!t.token.id_token||!t.token.access_token)throw(0,p.zP)(h.PM);const n=new Date(1e3*(r+(t.token.expires_in||0))),o=l.Z_(t.token.id_token,this.crypto.base64Decode),s=this.fromNaaAccountInfo(t.account,o),i=t.token.scope||e.scope;return{authority:t.token.authority||s.environment,uniqueId:s.localAccountId,tenantId:s.tenantId,scopes:i.split(" "),account:s,idToken:t.token.id_token,idTokenClaims:o,accessToken:t.token.access_token,fromCache:!0,expiresOn:n,tokenType:e.authenticationScheme||d.hO.BEARER,correlationId:e.correlationId,extExpiresOn:n,state:e.state}}fromNaaAccountInfo(e,t){const r=t||e.idTokenClaims,n=e.localAccountId||r?.oid||r?.sub||"",o=e.tenantId||r?.tid||"",s=e.homeAccountId||`${n}.${o}`,i=e.username||r?.preferred_username||"",c=e.name||r?.name;return{homeAccountId:s,environment:e.environment,tenantId:o,username:i,localAccountId:n,name:c,idToken:e.idToken,idTokenClaims:r}}fromBridgeError(e){if(!function(e){return void 0!==e.status}(e))return new E.l4("unknown_error","An unknown error occurred");switch(e.status){case"USER_CANCEL":return new p.er(h.$R);case"NO_NETWORK":return new p.er(h.Mq);case"ACCOUNT_UNAVAILABLE":return new p.er(h.cX);case"DISABLED":return new p.er(h.Ls);case"NESTED_APP_AUTH_UNAVAILABLE":return new p.er(e.code||h.Ls,e.description);case"TRANSIENT_ERROR":case"PERSISTENT_ERROR":return new A.n(e.code,e.description);case"USER_INTERACTION_REQUIRED":return new g.Yo(e.code,e.description);default:return new E.l4(e.code,e.description)}}}const C="unsupported_method",k="The PKCE code challenge and verifier could not be generated.";class v extends E.l4{constructor(e,t){super(e,t),Object.setPrototypeOf(this,v.prototype),this.name="NestedAppAuthError"}static createUnsupportedError(){return new v(C,k)}}var w=r(18896),I=r(30882);class T{constructor(e){this.operatingContext=e;const t=this.operatingContext.getBridgeProxy();if(void 0===t)throw new Error("unexpected: bridgeProxy is undefined");this.bridgeProxy=t,this.config=e.getConfig(),this.logger=this.operatingContext.getLogger(),this.performanceClient=this.config.telemetry.client,this.browserCrypto=e.isBrowserEnvironment()?new c.Q(this.logger,this.performanceClient):n.d,this.eventHandler=new w.b(this.logger,this.browserCrypto),this.nestedAppAuthAdapter=new m(this.config.auth.clientId,this.config.auth.clientCapabilities,this.browserCrypto,this.logger)}getBrowserStorage(){throw v.createUnsupportedError()}getEventHandler(){return this.eventHandler}static async createController(e){const t=new T(e);return Promise.resolve(t)}initialize(){return Promise.resolve()}async acquireTokenInteractive(e){this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_START,i.s_.Popup,e);const t=this.performanceClient.startMeasurement(o.Ak.AcquireTokenPopup,e.correlationId);t?.add({nestedAppAuthRequest:!0});try{const r=this.nestedAppAuthAdapter.toNaaTokenRequest(e),n=s.HY(),o=await this.bridgeProxy.getTokenInteractive(r),c=this.nestedAppAuthAdapter.fromNaaTokenResponse(r,o,n);return this.operatingContext.setActiveAccount(c.account),this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_SUCCESS,i.s_.Popup,c),t.add({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),t.end({success:!0,requestId:c.requestId}),c}catch(e){const r=this.nestedAppAuthAdapter.fromBridgeError(e);throw this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_FAILURE,i.s_.Popup,null,e),t.end({errorCode:r.errorCode,subErrorCode:r.subError,success:!1}),r}}async acquireTokenSilentInternal(e){this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_START,i.s_.Silent,e);const t=this.performanceClient.startMeasurement(o.Ak.SsoSilent,e.correlationId);t?.increment({visibilityChangeCount:0}),t?.add({nestedAppAuthRequest:!0});try{const r=this.nestedAppAuthAdapter.toNaaTokenRequest(e),n=s.HY(),o=await this.bridgeProxy.getTokenSilent(r),c=this.nestedAppAuthAdapter.fromNaaTokenResponse(r,o,n);return this.operatingContext.setActiveAccount(c.account),this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_SUCCESS,i.s_.Silent,c),t?.add({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),t?.end({success:!0,requestId:c.requestId}),c}catch(e){const r=this.nestedAppAuthAdapter.fromBridgeError(e);throw this.eventHandler.emitEvent(I.t.ACQUIRE_TOKEN_FAILURE,i.s_.Silent,null,e),t?.end({errorCode:r.errorCode,subErrorCode:r.subError,success:!1}),r}}async acquireTokenPopup(e){return this.acquireTokenInteractive(e)}acquireTokenRedirect(e){throw v.createUnsupportedError()}async acquireTokenSilent(e){return this.acquireTokenSilentInternal(e)}acquireTokenByCode(e){throw v.createUnsupportedError()}acquireTokenNative(e,t,r){throw v.createUnsupportedError()}acquireTokenByRefreshToken(e,t){throw v.createUnsupportedError()}addEventCallback(e){return this.eventHandler.addEventCallback(e)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){throw v.createUnsupportedError()}removePerformanceCallback(e){throw v.createUnsupportedError()}enableAccountStorageEvents(){throw v.createUnsupportedError()}disableAccountStorageEvents(){throw v.createUnsupportedError()}getAccount(e){throw v.createUnsupportedError()}getAccountByHomeId(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.homeAccountId===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAccountByLocalId(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.localAccountId===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAccountByUsername(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.username===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAllAccounts(){const e=this.operatingContext.getActiveAccount();return void 0!==e?[this.nestedAppAuthAdapter.fromNaaAccountInfo(e)]:[]}handleRedirectPromise(e){throw v.createUnsupportedError()}loginPopup(e){if(void 0!==e)return this.acquireTokenInteractive(e);throw v.createUnsupportedError()}loginRedirect(e){throw v.createUnsupportedError()}logout(e){throw v.createUnsupportedError()}logoutRedirect(e){throw v.createUnsupportedError()}logoutPopup(e){throw v.createUnsupportedError()}ssoSilent(e){return this.acquireTokenSilentInternal(e)}getTokenCache(){throw v.createUnsupportedError()}getLogger(){return this.logger}setLogger(e){this.logger=e}setActiveAccount(e){this.logger.warning("nestedAppAuth does not support setActiveAccount")}getActiveAccount(){const e=this.operatingContext.getActiveAccount();return void 0!==e?this.nestedAppAuthAdapter.fromNaaAccountInfo(e):null}initializeWrapperLibrary(e,t){}setNavigationClient(e){this.logger.warning("setNavigationClient is not supported in nested app auth")}getConfiguration(){return this.config}isBrowserEnv(){return this.operatingContext.isBrowserEnvironment()}getBrowserCrypto(){return this.browserCrypto}getPerformanceClient(){throw v.createUnsupportedError()}getRedirectResponse(){throw v.createUnsupportedError()}preflightBrowserEnvironmentCheck(e,t){throw v.createUnsupportedError()}async clearCache(e){throw v.createUnsupportedError()}async hydrateCache(e,t){throw v.createUnsupportedError()}}}}]);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy