-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 ability to obtain result of Authentication process #12
Add ability to obtain result of Authentication process #12
Conversation
Define new closure callback to get result of authentication operation
Update test case for AuthenticationResult
This is awesome, thank you! I will look more closely soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wonderful! Just had two questions about the new function type.
@@ -20,7 +20,8 @@ public enum AuthenticatorError: Error { | |||
/// Manage state required to executed authenticated URLRequests. | |||
public final class Authenticator { | |||
public typealias UserAuthenticator = (URL, String) async throws -> URL | |||
|
|||
public typealias AuthenticationResult = (Login?, AuthenticatorError?) -> Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions for this type.
First, what do you think about making the parameter Result<Login, AuthenticatorError>
? This would help to ease the optional juggling.
Second, I keep coming back to the name AuthenticationResult
. What do you think about something like DidLogin
or LoginHandler
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Not sure why but I never use the
Result
type. However I think this is much better. Will make the change. -
I feel that there are a lot of
Provider
/Handler
like types in the package. Do you thinkDidLogin
would go against the naming convention? AlsoLoginHandler
feels that you need to handle the login which is not the case. It's only a reporting mechanism.
What aboutAuthenticationStatusHandler
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Great! It took me a while to warm up to
Result
too. And, I often now prefer throwing, since it fits in much better with concurrency. But in this case, it does seem like a good fit. -
Yeah, I didn't think too hard, but you are making a good point. That name works for me!
…StatusHandler Update README.md to showcase new usage Add new test to validate that error in AuthenticationStatusHandler is properly propagated
Closes #11.