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: removed the validation of incoming redirect_uri once the webauth flow resumes back #850

Merged
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
3 changes: 1 addition & 2 deletions Auth0/LoginTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class LoginTransaction: NSObject, AuthTransaction {
}

private func handleURL(_ url: URL) -> Bool {
guard url.absoluteString.lowercased().hasPrefix(self.redirectURL.absoluteString.lowercased()),
let components = URLComponents(url: url, resolvingAgainstBaseURL: true),
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true),
case let items = self.handler.values(fromComponents: components),
has(state: self.state, inItems: items) else {
let error = WebAuthError(code: .unknown("Invalid callback URL: \(url.absoluteString)"))
Expand Down
8 changes: 0 additions & 8 deletions Auth0Tests/LoginTransactionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ class LoginTransactionSpec: QuickSpec {
expect(transaction.userAgent).to(beNil())
}

it("should fail to handle url with invalid prefix") {
let url = URL(string: "https://invalid.auth0.com/callback?code=\(code)&state=state")!
let expectedError = WebAuthError(code: .unknown("Invalid callback URL: \(url.absoluteString)"))
expect(transaction.resume(url)) == false
expect(userAgent.result).to(haveWebAuthError(expectedError))
expect(transaction.userAgent).to(beNil())
}

it("should fail to handle url without state") {
let url = URL(string: "https://samples.auth0.com/callback?code=\(code)")!
let expectedError = WebAuthError(code: .unknown("Invalid callback URL: \(url.absoluteString)"))
Expand Down
Loading