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

Add authentication before checking for updates #6

Merged
merged 9 commits into from
Nov 13, 2024
Merged

Conversation

Itaybre
Copy link
Contributor

@Itaybre Itaybre commented Oct 31, 2024

No description provided.

@Itaybre Itaybre changed the title Add authentication before updates Add authentication before checking for updates Oct 31, 2024
}
}

private class PresentationContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to make this configurable so users can pass in their own ASWebAuthenticationPresentationContextProviding

@@ -125,6 +143,9 @@ public final class ETDistribution: NSObject {
}
var request = URLRequest(url: url)
request.httpMethod = "GET"
if let accessToken = accessToken {
request.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the response handling I think we need a case for when the authorization was invalid. Like if the token was manually revoke. Seems like right now the user will be stuck until the system time > refresh time. Instead if the authorization is invalid I think we should try to refresh it and if that fails show the login screen. We can also handle the case where the loginSetting wasn't provided but we get back an authorization error to automatically show the login screen

] as CFDictionary

var result: AnyObject?
let status = SecItemCopyMatching(query, &result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Itaybre Itaybre merged commit b2d32c3 into main Nov 13, 2024
2 checks passed
@Itaybre Itaybre deleted the feature/login branch November 13, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants