From 4d1ac9ad4b843f9b03f347a536907fecaae91a1e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 25 Apr 2024 15:38:17 -0700 Subject: [PATCH] Rename redirectUri to redirectURI. --- .../FeedlyAccountDelegate+OAuth.swift | 2 +- .../OAuthAccountAuthorizationOperation.swift | 4 ++-- .../OAuthAuthorizationClient+Feedly.swift | 4 ++-- .../OAuthAuthorizationCodeGranting.swift | 20 +++++++++---------- .../Feedly/FeedlyTestSupport.swift | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift index 1a014e5f6..9c54401af 100644 --- a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift +++ b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift @@ -31,7 +31,7 @@ extension FeedlyAccountDelegate { static func oauthAuthorizationCodeGrantRequest(secretsProvider: SecretsProvider) -> URLRequest { let client = environment.oauthAuthorizationClient(secretsProvider: secretsProvider) let authorizationRequest = OAuthAuthorizationRequest(clientID: client.id, - redirectUri: client.redirectUri, + redirectURI: client.redirectURI, scope: oauthAuthorizationGrantScope, state: client.state) let baseURLComponents = environment.baseUrlComponents diff --git a/Account/Sources/Account/Feedly/OAuthAccountAuthorizationOperation.swift b/Account/Sources/Account/Feedly/OAuthAccountAuthorizationOperation.swift index e8533703b..a0dea9e0e 100644 --- a/Account/Sources/Account/Feedly/OAuthAccountAuthorizationOperation.swift +++ b/Account/Sources/Account/Feedly/OAuthAccountAuthorizationOperation.swift @@ -64,8 +64,8 @@ public enum OAuthAccountAuthorizationOperationError: LocalizedError { } } - guard let redirectUri = URL(string: oauthClient.redirectUri), let scheme = redirectUri.scheme else { - assertionFailure("Could not get callback URL scheme from \(oauthClient.redirectUri)") + guard let redirectURI = URL(string: oauthClient.redirectURI), let scheme = redirectURI.scheme else { + assertionFailure("Could not get callback URL scheme from \(oauthClient.redirectURI)") return DispatchQueue.main.async { self.didEndAuthentication(url: nil, error: URLError(.badURL)) } diff --git a/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift b/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift index a94903e7c..3bbb6701b 100644 --- a/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift +++ b/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift @@ -17,7 +17,7 @@ extension OAuthAuthorizationClient { /// These placeholders are substituted at build time using a Run Script phase with build settings. /// https://developer.feedly.com/v3/auth/#authenticating-a-user-and-obtaining-an-auth-code return OAuthAuthorizationClient(id: secretsProvider.feedlyClientId, - redirectUri: "netnewswire://auth/feedly", + redirectURI: "netnewswire://auth/feedly", state: nil, secret: secretsProvider.feedlyClientSecret) } @@ -30,7 +30,7 @@ extension OAuthAuthorizationClient { /// They are due to expire on May 31st 2020. /// Verify the sandbox URL host in the FeedlyAPICaller.API.baseUrlComponents method, too. return OAuthAuthorizationClient(id: "sandbox", - redirectUri: "urn:ietf:wg:oauth:2.0:oob", + redirectURI: "urn:ietf:wg:oauth:2.0:oob", state: nil, secret: "4ZfZ5DvqmJ8vKgMj") } diff --git a/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift b/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift index 56b4b76d0..fc556133e 100644 --- a/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift +++ b/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift @@ -15,13 +15,13 @@ import Feedly /// Accounts are responsible for the scope. public struct OAuthAuthorizationClient: Equatable { public var id: String - public var redirectUri: String + public var redirectURI: String public var state: String? public var secret: String - public init(id: String, redirectUri: String, state: String?, secret: String) { + public init(id: String, redirectURI: String, state: String?, secret: String) { self.id = id - self.redirectUri = redirectUri + self.redirectURI = redirectURI self.state = state self.secret = secret } @@ -32,13 +32,13 @@ public struct OAuthAuthorizationClient: Equatable { public struct OAuthAuthorizationRequest { public let responseType = "code" public var clientID: String - public var redirectUri: String + public var redirectURI: String public var scope: String public var state: String? - public init(clientID: String, redirectUri: String, scope: String, state: String?) { + public init(clientID: String, redirectURI: String, scope: String, state: String?) { self.clientID = clientID - self.redirectUri = redirectUri + self.redirectURI = redirectURI self.scope = scope self.state = state } @@ -48,7 +48,7 @@ public struct OAuthAuthorizationRequest { URLQueryItem(name: "response_type", value: responseType), URLQueryItem(name: "client_id", value: clientID), URLQueryItem(name: "scope", value: scope), - URLQueryItem(name: "redirect_uri", value: redirectUri), + URLQueryItem(name: "redirect_uri", value: redirectURI), ] } } @@ -63,7 +63,7 @@ public struct OAuthAuthorizationResponse { public extension OAuthAuthorizationResponse { init(url: URL, client: OAuthAuthorizationClient) throws { - guard let scheme = url.scheme, client.redirectUri.hasPrefix(scheme) else { + guard let scheme = url.scheme, client.redirectURI.hasPrefix(scheme) else { throw URLError(.unsupportedURL) } guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { @@ -113,7 +113,7 @@ public enum OAuthAuthorizationError: String, Sendable { public struct OAuthAccessTokenRequest: Encodable, Sendable { public let grantType = "authorization_code" public var code: String - public var redirectUri: String + public var redirectURI: String public var state: String? public var clientID: String @@ -123,7 +123,7 @@ public struct OAuthAccessTokenRequest: Encodable, Sendable { public init(authorizationResponse: OAuthAuthorizationResponse, scope: String, client: OAuthAuthorizationClient) { self.code = authorizationResponse.code - self.redirectUri = client.redirectUri + self.redirectURI = client.redirectURI self.state = authorizationResponse.state self.clientID = client.id self.clientSecret = client.secret diff --git a/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift b/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift index 34b608cc9..53ea6d4f3 100644 --- a/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift +++ b/Account/Tests/AccountTests/Feedly/FeedlyTestSupport.swift @@ -39,7 +39,7 @@ class FeedlyTestSupport { } func makeMockOAuthClient() -> OAuthAuthorizationClient { - return OAuthAuthorizationClient(id: "test", redirectUri: "test://test/auth", state: nil, secret: "password") + return OAuthAuthorizationClient(id: "test", redirectURI: "test://test/auth", state: nil, secret: "password") } func removeCredentials(matching type: CredentialsType, from account: Account) {