Commit e8a71fe7 authored by Nina Satragno's avatar Nina Satragno Committed by Commit Bot

[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: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747346}
parent 97defc9e
...@@ -504,7 +504,6 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase { ...@@ -504,7 +504,6 @@ 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,
...@@ -529,10 +528,9 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase { ...@@ -529,10 +528,9 @@ 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), kTestChallenge, base::TimeDelta::FromSeconds(30), "acme.com",
base::TimeDelta::FromSeconds(30), "acme.com", std::move(credentials), std::move(credentials), device::UserVerificationRequirement::kPreferred,
device::UserVerificationRequirement::kPreferred, base::nullopt, base::nullopt, std::vector<device::CableDiscoveryData>());
std::vector<device::CableDiscoveryData>());
return mojo_options; return mojo_options;
} }
......
...@@ -214,9 +214,6 @@ struct PublicKeyCredentialRequestOptions { ...@@ -214,9 +214,6 @@ 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;
...@@ -306,9 +303,6 @@ struct PublicKeyCredentialCreationOptions { ...@@ -306,9 +303,6 @@ 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,21 +25,6 @@ ...@@ -25,21 +25,6 @@
#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;
...@@ -410,9 +395,6 @@ TypeConverter<PublicKeyCredentialCreationOptionsPtr, ...@@ -410,9 +395,6 @@ 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
...@@ -556,9 +538,6 @@ TypeConverter<PublicKeyCredentialRequestOptionsPtr, ...@@ -556,9 +538,6 @@ 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