Rename redirectUri to redirectURI.

This commit is contained in:
Brent Simmons 2024-04-25 15:38:17 -07:00
parent fcbe355fdd
commit 4d1ac9ad4b
5 changed files with 16 additions and 16 deletions

View File

@ -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

View File

@ -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))
}

View File

@ -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")
}

View File

@ -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

View File

@ -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) {