Commit f322c4be authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Revert "[webauthn] Clean up adjusted_timeout"

This reverts commit e8a71fe7.

Reason for revert: Broke downstream build (remaining reference: https://crrev.com/i/2687160)

Original change's description:
> [webauthn] Clean up adjusted_timeout
> 
> crrev.com/c/2084725 moved the timeout adjustment logic to the browser
> side while keeping the old behaviour to make internal android source
> happy. This removes the old behaviour.
> 
> Fixed: 976428
> Change-Id: I2c6acb06f3efc6c4efbfc917b06a06603b81e7e6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090091
> Commit-Queue: Nina Satragno <nsatragno@chromium.org>
> Commit-Queue: Ken Buchanan <kenrb@chromium.org>
> Auto-Submit: Nina Satragno <nsatragno@chromium.org>
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#747346}

TBR=kenrb@chromium.org,nsatragno@chromium.org

Change-Id: Ic94a92fdb09d498755d2ad5d6f038b73a23ed8d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090617Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747413}
parent 76ed93dc
...@@ -504,6 +504,7 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase { ...@@ -504,6 +504,7 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase {
std::vector<uint8_t> kTestChallenge{0, 0, 0}; std::vector<uint8_t> kTestChallenge{0, 0, 0};
auto mojo_options = blink::mojom::PublicKeyCredentialCreationOptions::New( auto mojo_options = blink::mojom::PublicKeyCredentialCreationOptions::New(
rp, user, kTestChallenge, parameters, base::TimeDelta::FromSeconds(30), rp, user, kTestChallenge, parameters, base::TimeDelta::FromSeconds(30),
base::TimeDelta::FromSeconds(30),
std::vector<device::PublicKeyCredentialDescriptor>(), std::vector<device::PublicKeyCredentialDescriptor>(),
device::AuthenticatorSelectionCriteria(), device::AuthenticatorSelectionCriteria(),
device::AttestationConveyancePreference::kNone, nullptr, device::AttestationConveyancePreference::kNone, nullptr,
...@@ -528,9 +529,10 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase { ...@@ -528,9 +529,10 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase {
std::vector<uint8_t> kTestChallenge{0, 0, 0}; std::vector<uint8_t> kTestChallenge{0, 0, 0};
auto mojo_options = blink::mojom::PublicKeyCredentialRequestOptions::New( auto mojo_options = blink::mojom::PublicKeyCredentialRequestOptions::New(
kTestChallenge, base::TimeDelta::FromSeconds(30), "acme.com", kTestChallenge, base::TimeDelta::FromSeconds(30),
std::move(credentials), device::UserVerificationRequirement::kPreferred, base::TimeDelta::FromSeconds(30), "acme.com", std::move(credentials),
base::nullopt, std::vector<device::CableDiscoveryData>()); device::UserVerificationRequirement::kPreferred, base::nullopt,
std::vector<device::CableDiscoveryData>());
return mojo_options; return mojo_options;
} }
......
...@@ -214,6 +214,9 @@ struct PublicKeyCredentialRequestOptions { ...@@ -214,6 +214,9 @@ struct PublicKeyCredentialRequestOptions {
// relying party. // relying party.
mojo_base.mojom.TimeDelta? timeout; mojo_base.mojom.TimeDelta? timeout;
// TODO(nsatragno): remove this after updating android-internal.
mojo_base.mojom.TimeDelta adjusted_timeout;
// An ASCII serialization of the origin claimed by the relying party. // An ASCII serialization of the origin claimed by the relying party.
string relying_party_id; string relying_party_id;
...@@ -303,6 +306,9 @@ struct PublicKeyCredentialCreationOptions { ...@@ -303,6 +306,9 @@ struct PublicKeyCredentialCreationOptions {
// relying party. // relying party.
mojo_base.mojom.TimeDelta? timeout; mojo_base.mojom.TimeDelta? timeout;
// TODO(nsatragno): remove this after updating android-internal.
mojo_base.mojom.TimeDelta adjusted_timeout;
// A list of credentials the relying party knows about. If an // A list of credentials the relying party knows about. If an
// authenticator has one of these credentials, it should not // authenticator has one of these credentials, it should not
// create a new one. // create a new one.
......
...@@ -25,6 +25,21 @@ ...@@ -25,6 +25,21 @@
#include "third_party/blink/renderer/modules/credentialmanager/password_credential.h" #include "third_party/blink/renderer/modules/credentialmanager/password_credential.h"
#include "third_party/blink/renderer/modules/credentialmanager/public_key_credential.h" #include "third_party/blink/renderer/modules/credentialmanager/public_key_credential.h"
namespace {
// Time to wait for an authenticator to successfully complete an operation.
constexpr base::TimeDelta kAdjustedTimeoutLower =
base::TimeDelta::FromSeconds(10);
constexpr base::TimeDelta kAdjustedTimeoutUpper =
base::TimeDelta::FromMinutes(10);
base::TimeDelta AdjustTimeout(uint32_t timeout) {
base::TimeDelta adjusted_timeout;
adjusted_timeout = base::TimeDelta::FromMilliseconds(timeout);
return std::max(kAdjustedTimeoutLower,
std::min(kAdjustedTimeoutUpper, adjusted_timeout));
}
} // namespace
namespace mojo { namespace mojo {
using blink::mojom::blink::AttestationConveyancePreference; using blink::mojom::blink::AttestationConveyancePreference;
...@@ -395,6 +410,9 @@ TypeConverter<PublicKeyCredentialCreationOptionsPtr, ...@@ -395,6 +410,9 @@ TypeConverter<PublicKeyCredentialCreationOptionsPtr,
if (options->hasTimeout()) { if (options->hasTimeout()) {
mojo_options->timeout = mojo_options->timeout =
base::TimeDelta::FromMilliseconds(options->timeout()); base::TimeDelta::FromMilliseconds(options->timeout());
mojo_options->adjusted_timeout = AdjustTimeout(options->timeout());
} else {
mojo_options->adjusted_timeout = kAdjustedTimeoutUpper;
} }
// Steps 8 and 9 of // Steps 8 and 9 of
...@@ -538,6 +556,9 @@ TypeConverter<PublicKeyCredentialRequestOptionsPtr, ...@@ -538,6 +556,9 @@ TypeConverter<PublicKeyCredentialRequestOptionsPtr,
if (options->hasTimeout()) { if (options->hasTimeout()) {
mojo_options->timeout = mojo_options->timeout =
base::TimeDelta::FromMilliseconds(options->timeout()); base::TimeDelta::FromMilliseconds(options->timeout());
mojo_options->adjusted_timeout = AdjustTimeout(options->timeout());
} else {
mojo_options->adjusted_timeout = kAdjustedTimeoutUpper;
} }
mojo_options->relying_party_id = options->rpId(); mojo_options->relying_party_id = options->rpId();
......
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