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

[memoization] fix incorrect credentials asynchronous loop #11

Merged
merged 17 commits into from
Aug 3, 2018

Conversation

dodikk
Copy link

@dodikk dodikk commented Aug 1, 2018

Based on #10

Fixed an issue for the case when wrong credentials are entered by the user.
My memoization fix #9 has caused it.

The issue has been fixed for both the existing UIWebView based demo and for the WKWebView one.

Issue description

The page would not end up loading since wrong credentials will constantly be provided to the authentication challenge callback. For this reason, the credentials alert would not show up (since the credentials have been memoized but they are wrong).

The fix

  1. Fixed the condition for supplying the memoized credentials
-(BOOL)isUserInputCredentialsMemoized {
    
    BOOL hasInput = (nil != self.userInput);
    BOOL result = hasInput && self.isUserInputAcceptedByServer;
    
    return result;
}
  1. Marking credentials as "valid" in webViewDidFinishLoad:
    If not marked, the alert will show up all over again until cancelled by the user (as it had before).

[self.webView loadRequest: request];
}

#pragma mark - JAHPAuthenticatingHTTPProtocolDelegate
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same issue as before. I don't think we should mention JAHPAuthenticatingHTTPProtocolDelegate in this implementation because it isn't needed. I think it'll only confuse people.

Copy link
Collaborator

@hborders hborders left a comment

Choose a reason for hiding this comment

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

Ok. This looks good. Are you ready to merge?

@hborders
Copy link
Collaborator

hborders commented Aug 2, 2018

It seems like this is a combination of the other two PRs, so maybe you should close them?

@dodikk
Copy link
Author

dodikk commented Aug 3, 2018

It seems like this is a combination of the other two PRs, so maybe you should close them?

Indeed, it has a few commits on top of those previous ones as I've mentioned in the description. They will be automatically closed by github when this one gets merged.
I'll close them manually anyway as long as you've requested that.

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