Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix client id matching #166

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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))
Expand Down
1 change: 0 additions & 1 deletion Sources/WebAuthenticationUI/WebAuthentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public class WebAuthentication {
/// - issuer: The URL for the OAuth2 issuer.
/// - clientId: The client's ID.
/// - scopes: The scopes the client is requesting.
/// - responseType: The response type to expect.
/// - redirectUri: The redirect URI for the configured client.
/// - logoutRedirectUri: The logout URI for the client, if applicable.
/// - additionalParameters: Optional parameters to add to the authorization query string.
Expand Down
16 changes: 15 additions & 1 deletion Tests/AuthFoundationTests/OIDCLegacyMigratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,22 @@ final class OIDCLegacyMigratorTests: XCTestCase {
]
] as CFArray)
XCTAssertTrue(migrator.needsMigration)

// Test that a clientId match counts as a match
keychain.expect(noErr, result: [
[
"svce": "",
"acct": "clientId",
"class": "genp",
"cdat": Date(),
"mdat": Date(),
"pdmn": "ak",
"agrp": "com.okta.sample.app"
]
] as CFArray)
XCTAssertTrue(migrator.needsMigration)
}

func testMigrate() throws {
let notificationRecorder = NotificationRecorder(observing: [ .credentialMigrated ])

Expand Down
Loading