Commit e46cab8b authored by Sam Goto's avatar Sam Goto Committed by Chromium LUCI CQ

[webid] Prompt the user for permission before loading .well-known/webid

The .well-known/webid file can take an arbitrarily long time to load,
but even when it loads immediately, it introduces an unnecessarily long
delay between invoking the API and the browser UX responding to it.

It is the case that the .well-known/webid file can be done
uncredentialed, and hence in parallel, but for the sake of simplicity
I'm just changing some of the sequencing of events.

Upon acknowledgement of the permission prompt, we should also open the
modal dialog right away, before if finishes loading the signin_url,
because that can also take an arbitrarily long time to load and we want
to make sure the user understands who is accountable for the delay (i.e.
that the browser UX has responded to the gesture that the user made)

Bug: 1141125
Change-Id: I40fc02c03488d3a1d6de383b5397baf4cc7aa604
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2631451
Auto-Submit: Sam Goto <goto@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845859}
parent 95d79b23
......@@ -101,9 +101,14 @@ void FederatedAuthRequestImpl::RequestIdToken(const GURL& provider,
request_dialog_controller_ =
GetContentClient()->browser()->CreateIdentityRequestDialogController();
network_manager_->FetchIDPWellKnown(
base::BindOnce(&FederatedAuthRequestImpl::OnWellKnownFetched,
weak_ptr_factory_.GetWeakPtr()));
// Use the web contents of the page that initiated the WebID request (i.e.
// the Relying Party) for showing the initial permission dialog.
WebContents* web_contents =
WebContents::FromRenderFrameHost(render_frame_host());
request_dialog_controller_->ShowInitialPermissionDialog(
web_contents, base::BindOnce(&FederatedAuthRequestImpl::OnSigninApproved,
weak_ptr_factory_.GetWeakPtr()));
}
void FederatedAuthRequestImpl::OnWellKnownFetched(
......@@ -139,14 +144,11 @@ void FederatedAuthRequestImpl::OnWellKnownFetched(
CompleteRequest(RequestIdTokenStatus::kError, "");
return;
}
// Use the web contents of the page that initiated the WebID request (i.e.
// the Relying Party) for showing the initial permission dialog.
WebContents* web_contents =
WebContents::FromRenderFrameHost(render_frame_host());
request_dialog_controller_->ShowInitialPermissionDialog(
web_contents, base::BindOnce(&FederatedAuthRequestImpl::OnSigninApproved,
weak_ptr_factory_.GetWeakPtr()));
network_manager_->SendSigninRequest(
idp_endpoint_url_, id_request_,
base::BindOnce(&FederatedAuthRequestImpl::OnSigninResponseReceived,
weak_ptr_factory_.GetWeakPtr()));
}
void FederatedAuthRequestImpl::OnSigninApproved(
......@@ -156,9 +158,8 @@ void FederatedAuthRequestImpl::OnSigninApproved(
return;
}
network_manager_->SendSigninRequest(
idp_endpoint_url_, id_request_,
base::BindOnce(&FederatedAuthRequestImpl::OnSigninResponseReceived,
network_manager_->FetchIDPWellKnown(
base::BindOnce(&FederatedAuthRequestImpl::OnWellKnownFetched,
weak_ptr_factory_.GetWeakPtr()));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment