-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: [IOPID-2515] - Add SECURITY_LEVEL_MISMATCH event (#6460)
## Short description This PR adds `SECURITY_LEVEL_MISMATCH` event ## List of changes proposed in this pull request - Added `SECURITY_LEVEL_MISMATCH` event ## How to test The current implementation requires the `CieID` app to perform an `L2` login; if the `CieID` app is configured to allow only login with the `CIE` (L3), an `L3` login will be executed.
- Loading branch information
1 parent
170b99e
commit 99f0f97
Showing
8 changed files
with
69 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { select } from "typed-redux-saga/macro"; | ||
import * as O from "fp-ts/Option"; | ||
import { pipe } from "fp-ts/lib/function"; | ||
import { sequenceT } from "fp-ts/lib/Apply"; | ||
import { cieIDSelectedSecurityLevelSelector } from "../store/selectors"; | ||
import { idpSelector } from "../../../store/reducers/authentication"; | ||
import { IdpCIE_ID } from "../../../hooks/useNavigateToLoginMethod"; | ||
import { trackCieIdSecurityLevelMismatch } from "../analytics"; | ||
import { PublicSession } from "../../../../definitions/session_manager/PublicSession"; | ||
|
||
export function* shouldTrackLevelSecurityMismatchSaga( | ||
maybeSessionInformation: O.Option<PublicSession> | ||
) { | ||
const selectedSecurityLevel = yield* select( | ||
cieIDSelectedSecurityLevelSelector | ||
); | ||
const idpSelected = yield* select(idpSelector); | ||
const selectedLevelMismatches = pipe( | ||
sequenceT(O.Monad)(maybeSessionInformation, idpSelected), | ||
O.chainNullableK( | ||
([session, idp]) => | ||
selectedSecurityLevel && | ||
idp.id === IdpCIE_ID.id && | ||
!session.spidLevel?.includes(selectedSecurityLevel) | ||
), | ||
O.getOrElse(() => false) | ||
); | ||
|
||
if (selectedLevelMismatches) { | ||
trackCieIdSecurityLevelMismatch(); | ||
} | ||
} |
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