This repository has been archived by the owner on Feb 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
SCAL-233969: Add preauth info call, emit Info call success event Iframe load #100
Open
ajeet-lakhani-ts
wants to merge
9
commits into
main
Choose a base branch
from
SCAL-233969--optimise-info-call--v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2962320
SCAL-233969: Add preauth info call, emit Info call success event on i…
ajeet-lakhani-ts d672a09
Merge branch 'main' into SCAL-233969--optimise-info-call--v2
ajeet-lakhani-ts e8d8c8b
SCAL-233969: Unit test fix for InfoSuccess Event trigger
ajeet-lakhani-ts a15f60f
SCAL-233969: Disable preauth info fetch for perUrlOrg is enabled
ajeet-lakhani-ts 41eb671
Merge branch 'main' into SCAL-233969--optimise-info-call--v2
ajeet-lakhani-ts 8728360
SCAL-233969: Add preAuthCache queryparam for iframe, Add flag disable…
ajeet-lakhani-ts 379c165
SCAL-233969: Test fix
ajeet-lakhani-ts 0d95250
SCAL-233969: Remove commented code
ajeet-lakhani-ts 0c48c47
SCAL-233969: Updated comment
ajeet-lakhani-ts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
} from './utils/authService'; | ||
import { isActiveService } from './utils/authService/tokenizedAuthService'; | ||
import { logger } from './utils/logger'; | ||
import { getSessionInfo } from './utils/sessionInfoService'; | ||
import { getSessionInfo, getPreauthInfo } from './utils/sessionInfoService'; | ||
import { ERROR_MESSAGE } from './errors'; | ||
|
||
// eslint-disable-next-line import/no-mutable-exports | ||
|
@@ -42,7 +42,7 @@ | |
} | ||
|
||
/** | ||
* Enum for auth status emitted by the emitter returned from {@link init}. | ||
* @group Authentication / Init | ||
*/ | ||
export enum AuthStatus { | ||
|
@@ -54,6 +54,11 @@ | |
* Emits when the SDK authenticates successfully | ||
*/ | ||
SDK_SUCCESS = 'SDK_SUCCESS', | ||
/** | ||
* @hidden | ||
* Emits when iframe is loaded and session info is available | ||
*/ | ||
SESSION_INFO_SUCCESS = 'SESSION_INFO_SUCCESS', | ||
/** | ||
* Emits when the app sends an authentication success message | ||
*/ | ||
|
@@ -66,13 +71,13 @@ | |
* Emitted when inPopup is true in the SAMLRedirect flow and the | ||
* popup is waiting to be triggered either programmatically | ||
* or by the trigger button. | ||
* @version SDK: 1.19.0 | ||
Check warning on line 74 in src/auth.ts
|
||
*/ | ||
WAITING_FOR_POPUP = 'WAITING_FOR_POPUP', | ||
} | ||
|
||
/** | ||
* Event emitter returned from {@link init}. | ||
* @group Authentication / Init | ||
*/ | ||
export interface AuthEventEmitter { | ||
|
@@ -100,7 +105,7 @@ | |
once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this; | ||
/** | ||
* Trigger an event on the emitter returned from init. | ||
* @param {@link AuthEvent} | ||
Check warning on line 108 in src/auth.ts
|
||
*/ | ||
emit(event: AuthEvent, ...args: any[]): boolean; | ||
/** | ||
|
@@ -119,7 +124,7 @@ | |
} | ||
|
||
/** | ||
* Events which can be triggered on the emitter returned from {@link init}. | ||
* @group Authentication / Init | ||
*/ | ||
export enum AuthEvent { | ||
|
@@ -132,7 +137,7 @@ | |
|
||
let authEE: EventEmitter<AuthStatus | AuthEvent>; | ||
|
||
/** | ||
* | ||
*/ | ||
export function getAuthEE(): EventEmitter<AuthStatus | AuthEvent> { | ||
|
@@ -141,7 +146,7 @@ | |
|
||
/** | ||
* | ||
* @param eventEmitter | ||
Check warning on line 149 in src/auth.ts
|
||
*/ | ||
export function setAuthEE(eventEmitter: EventEmitter<AuthStatus | AuthEvent>): void { | ||
authEE = eventEmitter; | ||
|
@@ -167,6 +172,7 @@ | |
return; | ||
} | ||
try { | ||
getPreauthInfo(); | ||
const sessionInfo = await getSessionInfo(); | ||
authEE.emit(AuthStatus.SUCCESS, sessionInfo); | ||
} catch (e) { | ||
|
@@ -176,7 +182,7 @@ | |
|
||
/** | ||
* | ||
* @param failureType | ||
Check warning on line 185 in src/auth.ts
|
||
*/ | ||
export function notifyAuthFailure(failureType: AuthFailureType): void { | ||
if (!authEE) { | ||
|
@@ -223,6 +229,7 @@ | |
*/ | ||
export async function postLoginService(): Promise<void> { | ||
try { | ||
getPreauthInfo(); | ||
const sessionInfo = await getSessionInfo(); | ||
ajeet-lakhani-ts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
releaseVersion = sessionInfo.releaseVersion; | ||
const embedConfig = getEmbedConfig(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace this
getSessionInfo
with thegetPreauthInfo
here? Better to avoid multiple api calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or update the
getSessionInfo
to callgetPreauthInfo
internally and replace the dependency on old/info
callThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is decided with TSE to keep both APIs as older customers won't have preauth info API. Check more detail here - https://thoughtspot.slack.com/archives/C082G97N8BZ/p1732810938126219