Commit 570c3c6c authored by Martin Kreichgauer's avatar Martin Kreichgauer Committed by Commit Bot

fido/win: set credential and user in AuthenticatorGetAssertionResponse

Also remove extraneous fido namespace for consistency with the rest of
//device/fido.

Bug: 898718
Change-Id: I5d44220ade620459a0f82b0446ba585bd62913bd
Reviewed-on: https://chromium-review.googlesource.com/c/1313732
Commit-Queue: Martin Kreichgauer <martinkr@chromium.org>
Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605058}
parent 6d8de33f
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "device/fido/win/webauthn.h" #include "device/fido/win/webauthn.h"
namespace device { namespace device {
namespace fido {
// Time out all Windows API requests after 5 minutes. We maintain our own // Time out all Windows API requests after 5 minutes. We maintain our own
// timeout and cancel the operation when it expires, so this value simply needs // timeout and cancel the operation when it expires, so this value simply needs
...@@ -424,5 +423,4 @@ void WinNativeCrossPlatformAuthenticator::InvokeGetAssertionCallback( ...@@ -424,5 +423,4 @@ void WinNativeCrossPlatformAuthenticator::InvokeGetAssertionCallback(
std::move(cb).Run(status, std::move(response)); std::move(cb).Run(status, std::move(response));
} }
} // namespace fido
} // namespace device } // namespace device
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "device/fido/win/webauthn_api.h" #include "device/fido/win/webauthn_api.h"
namespace device { namespace device {
namespace fido {
// WinNativeCrossPlatformAuthenticator forwards WebAuthn requests to external // WinNativeCrossPlatformAuthenticator forwards WebAuthn requests to external
// authenticators via the native Windows WebAuthentication API // authenticators via the native Windows WebAuthentication API
...@@ -88,7 +87,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) WinNativeCrossPlatformAuthenticator ...@@ -88,7 +87,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) WinNativeCrossPlatformAuthenticator
DISALLOW_COPY_AND_ASSIGN(WinNativeCrossPlatformAuthenticator); DISALLOW_COPY_AND_ASSIGN(WinNativeCrossPlatformAuthenticator);
}; };
} // namespace fido
} // namespace device } // namespace device
#endif // DEVICE_FIDO_WIN_AUTHENTICATOR_H_ #endif // DEVICE_FIDO_WIN_AUTHENTICATOR_H_
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "device/fido/opaque_attestation_statement.h" #include "device/fido/opaque_attestation_statement.h"
namespace device { namespace device {
namespace fido {
base::Optional<AuthenticatorMakeCredentialResponse> base::Optional<AuthenticatorMakeCredentialResponse>
ToAuthenticatorMakeCredentialResponse( ToAuthenticatorMakeCredentialResponse(
...@@ -68,10 +67,22 @@ ToAuthenticatorGetAssertionResponse(const WEBAUTHN_ASSERTION& assertion) { ...@@ -68,10 +67,22 @@ ToAuthenticatorGetAssertionResponse(const WEBAUTHN_ASSERTION& assertion) {
assertion.cbAuthenticatorData); assertion.cbAuthenticatorData);
return base::nullopt; return base::nullopt;
} }
return AuthenticatorGetAssertionResponse( AuthenticatorGetAssertionResponse response(
std::move(*authenticator_data), std::move(*authenticator_data),
std::vector<uint8_t>(assertion.pbSignature, std::vector<uint8_t>(assertion.pbSignature,
assertion.pbSignature + assertion.cbSignature)); assertion.pbSignature + assertion.cbSignature));
if (assertion.Credential.cbId > 0) {
response.SetCredential(PublicKeyCredentialDescriptor(
CredentialType::kPublicKey,
std::vector<uint8_t>(
assertion.Credential.pbId,
assertion.Credential.pbId + assertion.Credential.cbId)));
}
if (assertion.cbUserId > 0) {
response.SetUserEntity(PublicKeyCredentialUserEntity(std::vector<uint8_t>(
assertion.pbUserId, assertion.pbUserId + assertion.cbUserId)));
}
return response;
} }
uint32_t ToWinUserVerificationRequirement( uint32_t ToWinUserVerificationRequirement(
...@@ -116,5 +127,4 @@ CtapDeviceResponseCode WinErrorNameToCtapDeviceResponseCode( ...@@ -116,5 +127,4 @@ CtapDeviceResponseCode WinErrorNameToCtapDeviceResponseCode(
: CtapDeviceResponseCode::kCtap2ErrOther; : CtapDeviceResponseCode::kCtap2ErrOther;
} }
} // namespace fido
} // namespace device } // namespace device
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
namespace device { namespace device {
namespace fido {
COMPONENT_EXPORT(DEVICE_FIDO) COMPONENT_EXPORT(DEVICE_FIDO)
base::Optional<AuthenticatorMakeCredentialResponse> base::Optional<AuthenticatorMakeCredentialResponse>
...@@ -35,7 +34,6 @@ COMPONENT_EXPORT(DEVICE_FIDO) ...@@ -35,7 +34,6 @@ COMPONENT_EXPORT(DEVICE_FIDO)
CtapDeviceResponseCode WinErrorNameToCtapDeviceResponseCode( CtapDeviceResponseCode WinErrorNameToCtapDeviceResponseCode(
const base::string16& error_name); const base::string16& error_name);
} // namespace fido
} // namespace device } // namespace device
#endif // DEVICE_FIDO_WIN_TYPE_CONVERSIONS_H_ #endif // DEVICE_FIDO_WIN_TYPE_CONVERSIONS_H_
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
namespace device { namespace device {
namespace fido {
// WinWebAuthnApiImpl is the default implementation of WinWebAuthnApi, which // WinWebAuthnApiImpl is the default implementation of WinWebAuthnApi, which
// attempts to load webauthn.dll on intialization. // attempts to load webauthn.dll on intialization.
...@@ -125,5 +124,4 @@ WinWebAuthnApi* WinWebAuthnApi::GetDefault() { ...@@ -125,5 +124,4 @@ WinWebAuthnApi* WinWebAuthnApi::GetDefault() {
WinWebAuthnApi::~WinWebAuthnApi() = default; WinWebAuthnApi::~WinWebAuthnApi() = default;
} // namespace fido
} // namespace device } // namespace device
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/macros.h" #include "base/macros.h"
namespace device { namespace device {
namespace fido {
// WinWebAuthnApi is a wrapper for the native Windows WebAuthn API. // WinWebAuthnApi is a wrapper for the native Windows WebAuthn API.
// //
...@@ -87,7 +86,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) WinWebAuthnApi { ...@@ -87,7 +86,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) WinWebAuthnApi {
virtual const wchar_t* GetErrorName(HRESULT hr) = 0; virtual const wchar_t* GetErrorName(HRESULT hr) = 0;
}; };
} // namespace fido
} // namespace device } // namespace device
#endif // DEVICE_FIDO_WIN_WEBAUTHN_API_H_ #endif // DEVICE_FIDO_WIN_WEBAUTHN_API_H_
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