Skip to content

Commit

Permalink
refactored 'trim' call in chain to better readibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopapi committed Sep 16, 2021
1 parent 545f9e5 commit a8547c1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/utils/samlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1092,22 +1092,19 @@ export const assertionValidation = (
() => new Error("Empty AuthnContextClassRef")
)
),
E.map(AuthnContextClassRef =>
AuthnContextClassRef.textContent?.trim()
),
E.chain(
E.fromPredicate(
AuthnContextClassRef =>
AuthnContextClassRef.textContent?.trim() ===
SPID_LEVELS.SpidL1 ||
AuthnContextClassRef.textContent?.trim() ===
SPID_LEVELS.SpidL2 ||
AuthnContextClassRef.textContent?.trim() ===
SPID_LEVELS.SpidL3,
AuthnContextClassRef === SPID_LEVELS.SpidL1 ||
AuthnContextClassRef === SPID_LEVELS.SpidL2 ||
AuthnContextClassRef === SPID_LEVELS.SpidL3,
() =>
new Error("Invalid AuthnContextClassRef value")
)
),
E.map(AuthnContextClassRef =>
AuthnContextClassRef.textContent?.trim()
),
E.chain(
E.fromPredicate(
AuthnContextClassRef => {
Expand Down

0 comments on commit a8547c1

Please sign in to comment.