From a44b0ee0dbf63010a0a2172a8775b2c8345b138f Mon Sep 17 00:00:00 2001 From: thewahome Date: Wed, 27 Mar 2024 10:44:08 +0300 Subject: [PATCH 1/3] use a migration parameter --- .../authentication/AuthenticationWrapper.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/modules/authentication/AuthenticationWrapper.ts b/src/modules/authentication/AuthenticationWrapper.ts index 5c74800f78..034f0fab82 100644 --- a/src/modules/authentication/AuthenticationWrapper.ts +++ b/src/modules/authentication/AuthenticationWrapper.ts @@ -32,6 +32,18 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { selectedVersion: '', sampleHeaders: [] }; + private extraQueryParameters: { [key: string]: string } = (() => { + const params: { [key: string]: string } = { + mkt: geLocale + }; + + const migrationParam = process.env.REACT_APP_MIGRATION_PARAMETER; + if (migrationParam) { + params.MigrationQueryParam = migrationParam; + } + + return params; + })(); public static getInstance(): AuthenticationWrapper { if (!AuthenticationWrapper.instance) { @@ -50,7 +62,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { } public async logIn(sessionId = '', sampleQuery?: IQuery): Promise { - if(sampleQuery){ + if (sampleQuery) { this.sampleQuery = sampleQuery; this.performingStepUpAuth = true; } @@ -58,7 +70,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { // eslint-disable-next-line no-useless-catch try { const authResult = await this.getAuthResult([], sessionId); - if(this.performingStepUpAuth && authResult){ + if (this.performingStepUpAuth && authResult) { this.claimsAvailable = true; } return authResult; @@ -73,7 +85,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { authority: this.getAuthority(), prompt: 'select_account', redirectUri: getCurrentUri(), - extraQueryParameters: { mkt: geLocale } + extraQueryParameters: this.extraQueryParameters }; try { const result = await msalApplication.loginPopup(popUpRequest); @@ -180,7 +192,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { private getClaims(): string | undefined { const account = this.getAccount(); - if(account && (this.sampleQuery.sampleUrl !== '')){ + if (account && (this.sampleQuery.sampleUrl !== '')) { const claimsChallenge = new ClaimsChallenge(this.sampleQuery, account); const storedClaims = claimsChallenge.getClaimsFromStorage(); return storedClaims ? window.atob(storedClaims) : undefined; @@ -205,9 +217,10 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { authority: this.getAuthority(), prompt: 'select_account', redirectUri: getCurrentUri(), - extraQueryParameters: { mkt: geLocale }, + extraQueryParameters: this.extraQueryParameters, claims: this.getClaims() }; + console.log('popUpRequest', popUpRequest) if (this.consentingToNewScopes || this.performingStepUpAuth) { delete popUpRequest.prompt; From d1f230f47fb8c99a23e43e09e209d8aba70cb64d Mon Sep 17 00:00:00 2001 From: thewahome Date: Wed, 27 Mar 2024 16:23:15 +0300 Subject: [PATCH 2/3] add missing environment variable --- .github/workflows/linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 9d916999df..2268744ee1 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -185,6 +185,7 @@ jobs: REACT_APP_NOMINATION_PERIOD: ${{secrets.REACT_APP_NOMINATION_PERIOD}} REACT_APP_COOLDOWN_PERIOD: ${{secrets.REACT_APP_COOLDOWN_PERIOD}} REACT_APP_USAGE_TIME: ${{secrets.REACT_APP_USAGE_TIME}} + REACT_APP_MIGRATION_PARAMETER: ${{secrets.REACT_APP_MIGRATION_PARAMETER}} CI: false id: builddeploy uses: Azure/static-web-apps-deploy@v0.0.1-preview From ca882c2b1b0ac0d70baa37013a6ae1e8bc9cb490 Mon Sep 17 00:00:00 2001 From: thewahome Date: Thu, 28 Mar 2024 15:46:46 +0300 Subject: [PATCH 3/3] chore: fix rollout parameter --- src/modules/authentication/AuthenticationWrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/authentication/AuthenticationWrapper.ts b/src/modules/authentication/AuthenticationWrapper.ts index 034f0fab82..24399df836 100644 --- a/src/modules/authentication/AuthenticationWrapper.ts +++ b/src/modules/authentication/AuthenticationWrapper.ts @@ -39,7 +39,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { const migrationParam = process.env.REACT_APP_MIGRATION_PARAMETER; if (migrationParam) { - params.MigrationQueryParam = migrationParam; + params.safe_rollout = migrationParam; } return params;