Rename redirectUri to redirectURI.
This commit is contained in:
parent
fcbe355fdd
commit
4d1ac9ad4b
@ -31,7 +31,7 @@ extension FeedlyAccountDelegate {
|
|||||||
static func oauthAuthorizationCodeGrantRequest(secretsProvider: SecretsProvider) -> URLRequest {
|
static func oauthAuthorizationCodeGrantRequest(secretsProvider: SecretsProvider) -> URLRequest {
|
||||||
let client = environment.oauthAuthorizationClient(secretsProvider: secretsProvider)
|
let client = environment.oauthAuthorizationClient(secretsProvider: secretsProvider)
|
||||||
let authorizationRequest = OAuthAuthorizationRequest(clientID: client.id,
|
let authorizationRequest = OAuthAuthorizationRequest(clientID: client.id,
|
||||||
redirectUri: client.redirectUri,
|
redirectURI: client.redirectURI,
|
||||||
scope: oauthAuthorizationGrantScope,
|
scope: oauthAuthorizationGrantScope,
|
||||||
state: client.state)
|
state: client.state)
|
||||||
let baseURLComponents = environment.baseUrlComponents
|
let baseURLComponents = environment.baseUrlComponents
|
||||||
|
@ -64,8 +64,8 @@ public enum OAuthAccountAuthorizationOperationError: LocalizedError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let redirectUri = URL(string: oauthClient.redirectUri), let scheme = redirectUri.scheme else {
|
guard let redirectURI = URL(string: oauthClient.redirectURI), let scheme = redirectURI.scheme else {
|
||||||
assertionFailure("Could not get callback URL scheme from \(oauthClient.redirectUri)")
|
assertionFailure("Could not get callback URL scheme from \(oauthClient.redirectURI)")
|
||||||
return DispatchQueue.main.async {
|
return DispatchQueue.main.async {
|
||||||
self.didEndAuthentication(url: nil, error: URLError(.badURL))
|
self.didEndAuthentication(url: nil, error: URLError(.badURL))
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ extension OAuthAuthorizationClient {
|
|||||||
/// These placeholders are substituted at build time using a Run Script phase with build settings.
|
/// 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
|
/// https://developer.feedly.com/v3/auth/#authenticating-a-user-and-obtaining-an-auth-code
|
||||||
return OAuthAuthorizationClient(id: secretsProvider.feedlyClientId,
|
return OAuthAuthorizationClient(id: secretsProvider.feedlyClientId,
|
||||||
redirectUri: "netnewswire://auth/feedly",
|
redirectURI: "netnewswire://auth/feedly",
|
||||||
state: nil,
|
state: nil,
|
||||||
secret: secretsProvider.feedlyClientSecret)
|
secret: secretsProvider.feedlyClientSecret)
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ extension OAuthAuthorizationClient {
|
|||||||
/// They are due to expire on May 31st 2020.
|
/// They are due to expire on May 31st 2020.
|
||||||
/// Verify the sandbox URL host in the FeedlyAPICaller.API.baseUrlComponents method, too.
|
/// Verify the sandbox URL host in the FeedlyAPICaller.API.baseUrlComponents method, too.
|
||||||
return OAuthAuthorizationClient(id: "sandbox",
|
return OAuthAuthorizationClient(id: "sandbox",
|
||||||
redirectUri: "urn:ietf:wg:oauth:2.0:oob",
|
redirectURI: "urn:ietf:wg:oauth:2.0:oob",
|
||||||
state: nil,
|
state: nil,
|
||||||
secret: "4ZfZ5DvqmJ8vKgMj")
|
secret: "4ZfZ5DvqmJ8vKgMj")
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ import Feedly
|
|||||||
/// Accounts are responsible for the scope.
|
/// Accounts are responsible for the scope.
|
||||||
public struct OAuthAuthorizationClient: Equatable {
|
public struct OAuthAuthorizationClient: Equatable {
|
||||||
public var id: String
|
public var id: String
|
||||||
public var redirectUri: String
|
public var redirectURI: String
|
||||||
public var state: String?
|
public var state: String?
|
||||||
public var secret: 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.id = id
|
||||||
self.redirectUri = redirectUri
|
self.redirectURI = redirectURI
|
||||||
self.state = state
|
self.state = state
|
||||||
self.secret = secret
|
self.secret = secret
|
||||||
}
|
}
|
||||||
@ -32,13 +32,13 @@ public struct OAuthAuthorizationClient: Equatable {
|
|||||||
public struct OAuthAuthorizationRequest {
|
public struct OAuthAuthorizationRequest {
|
||||||
public let responseType = "code"
|
public let responseType = "code"
|
||||||
public var clientID: String
|
public var clientID: String
|
||||||
public var redirectUri: String
|
public var redirectURI: String
|
||||||
public var scope: String
|
public var scope: String
|
||||||
public var state: 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.clientID = clientID
|
||||||
self.redirectUri = redirectUri
|
self.redirectURI = redirectURI
|
||||||
self.scope = scope
|
self.scope = scope
|
||||||
self.state = state
|
self.state = state
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ public struct OAuthAuthorizationRequest {
|
|||||||
URLQueryItem(name: "response_type", value: responseType),
|
URLQueryItem(name: "response_type", value: responseType),
|
||||||
URLQueryItem(name: "client_id", value: clientID),
|
URLQueryItem(name: "client_id", value: clientID),
|
||||||
URLQueryItem(name: "scope", value: scope),
|
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 {
|
public extension OAuthAuthorizationResponse {
|
||||||
|
|
||||||
init(url: URL, client: OAuthAuthorizationClient) throws {
|
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)
|
throw URLError(.unsupportedURL)
|
||||||
}
|
}
|
||||||
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
||||||
@ -113,7 +113,7 @@ public enum OAuthAuthorizationError: String, Sendable {
|
|||||||
public struct OAuthAccessTokenRequest: Encodable, Sendable {
|
public struct OAuthAccessTokenRequest: Encodable, Sendable {
|
||||||
public let grantType = "authorization_code"
|
public let grantType = "authorization_code"
|
||||||
public var code: String
|
public var code: String
|
||||||
public var redirectUri: String
|
public var redirectURI: String
|
||||||
public var state: String?
|
public var state: String?
|
||||||
public var clientID: String
|
public var clientID: String
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public struct OAuthAccessTokenRequest: Encodable, Sendable {
|
|||||||
|
|
||||||
public init(authorizationResponse: OAuthAuthorizationResponse, scope: String, client: OAuthAuthorizationClient) {
|
public init(authorizationResponse: OAuthAuthorizationResponse, scope: String, client: OAuthAuthorizationClient) {
|
||||||
self.code = authorizationResponse.code
|
self.code = authorizationResponse.code
|
||||||
self.redirectUri = client.redirectUri
|
self.redirectURI = client.redirectURI
|
||||||
self.state = authorizationResponse.state
|
self.state = authorizationResponse.state
|
||||||
self.clientID = client.id
|
self.clientID = client.id
|
||||||
self.clientSecret = client.secret
|
self.clientSecret = client.secret
|
||||||
|
@ -39,7 +39,7 @@ class FeedlyTestSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makeMockOAuthClient() -> OAuthAuthorizationClient {
|
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) {
|
func removeCredentials(matching type: CredentialsType, from account: Account) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user