From 3bd2fbe4b59fd111bd18b36d37bef200f35e5180 Mon Sep 17 00:00:00 2001 From: Colin Tremblay Date: Fri, 2 Feb 2024 13:44:00 -0700 Subject: [PATCH] check for a clientId match before using the regex --- .../Migration/Migrators/OIDCLegacyMigrator.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift b/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift index 17da6a238..372b1d0cd 100644 --- a/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift +++ b/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift @@ -95,7 +95,8 @@ extension SDKVersion.Migration { let results = items.filter({ searchResult in // swiftlint:disable empty_string guard searchResult.service == "", - regex.matches(in: searchResult.account, range: NSRange(location: 0, length: searchResult.account.count)).count == 1 + clientId == searchResult.account || + regex.matches(in: searchResult.account, range: NSRange(location: 0, length: searchResult.account.count)).count == 1 else { return false } @@ -115,8 +116,9 @@ extension SDKVersion.Migration { .Search(service: "") .list() .filter({ searchResult in - regex.matches(in: searchResult.account, - range: NSRange(location: 0, length: searchResult.account.count)).count == 1 + clientId == searchResult.account || + regex.matches(in: searchResult.account, + range: NSRange(location: 0, length: searchResult.account.count)).count == 1 }).map({ searchResult in let item = try searchResult.get() return (searchResult, try decode(item.value))