Skip to content

Commit 0762b12

Browse files
committed
Add U2F migration guide
1 parent 945fed5 commit 0762b12

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ New features:
55
* New method `RegisteredCredential.builder().publicKeyEs256Raw(ByteArray)`. This
66
is a mutually exclusive alternative to `.publicKeyCose(ByteArray)`, for easier
77
backwards-compatibility with U2F-formatted (Raw ANSI X9.62) public keys.
8+
* "Migrating from U2F" section added to project README
89

910

1011
== Version 1.11.0 ==

README

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,70 @@ PublicKeyCredentialCreationOptions request = rp.startRegistration(
462462
----------
463463

464464

465+
== Migrating from U2F
466+
467+
This section is only relevant for applications that have user credentials registered via the
468+
link:https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-javascript-api-v1.2-ps-20170411.html[U2F JavaScript API].
469+
New WebAuthn deployments can skip this section.
470+
471+
The WebAuthn API is backwards-compatible with U2F authenticators,
472+
and credentials registered via the U2F API will continue to work with the WebAuthn API with the right settings.
473+
474+
To migrate to using the WebAuthn API, you need to do the following:
475+
476+
* Follow the link:#getting-started[Getting started] guide above to set up WebAuthn support in general.
477+
+
478+
Note that unlike a U2F AppID, the WebAuthn link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/data/RelyingPartyIdentity.RelyingPartyIdentityBuilder.html#id(java.lang.String)[RP ID]
479+
consists of only the domain name of the AppID.
480+
WebAuthn does not support link:https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-appid-and-facets-v1.2-ps-20170411.html[U2F Trusted Facet Lists].
481+
482+
* Set the
483+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/RelyingParty.RelyingPartyBuilder.html#appId(com.yubico.webauthn.extension.appid.AppId)[`appId()`]
484+
setting on your `RelyingParty` instance.
485+
The argument to the `appid()` setting should be the same as you used for the `appId` argument to the
486+
link:https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-javascript-api-v1.2-ps-20170411.html#high-level-javascript-api[U2F `register` and `sign` functions].
487+
+
488+
This will enable the link:https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-appid-extension[`appid`]
489+
and link:https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-appid-exclude-extension[`appidExclude`]
490+
extensions and configure the `RelyingParty` to accept the given AppId when verifying authenticator signatures.
491+
492+
* Generate a link:https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#user-handle[user handle] for each existing user
493+
and store it in their account,
494+
or decide on a method for deriving one deterministically from existing user attributes.
495+
For example, if your user records are assigned UUIDs, you can use that UUID as the user handle.
496+
You SHOULD NOT use a plain username or e-mail address, or hash of either, as the user handle -
497+
for more on this, see the link:https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-user-handle-privacy[User Handle Contents]
498+
privacy consideration.
499+
500+
* When your `CredentialRepository` creates a `RegisteredCredential` for a U2F credential,
501+
use the U2F key handle as the
502+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/RegisteredCredential.RegisteredCredentialBuilder.html#credentialId(com.yubico.webauthn.data.ByteArray)[credential ID].
503+
If you store key handles base64 encoded, you should decode them using
504+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/data/ByteArray.html#fromBase64(java.lang.String)[`ByteArray.fromBase64`]
505+
or
506+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/data/ByteArray.html#fromBase64Url(java.lang.String)[`ByteArray.fromBase64Url`]
507+
as appropriate before passing them to the `RegisteredCredential`.
508+
509+
* When your `CredentialRepository` creates a `RegisteredCredential` for a U2F credential,
510+
use the
511+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/RegisteredCredential.RegisteredCredentialBuilder.html#publicKeyEs256Raw(com.yubico.webauthn.data.ByteArray)[`publicKeyEs256Raw()`]
512+
method instead of link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core-minimal/latest/com/yubico/webauthn/RegisteredCredential.RegisteredCredentialBuilder.html#publicKeyCose(com.yubico.webauthn.data.ByteArray)[`publicKeyCose()`]
513+
to set the credential public key.
514+
515+
* Replace calls to the U2F
516+
link:https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-javascript-api-v1.2-ps-20170411.html#high-level-javascript-api[`register`]
517+
method with calls to `navigator.credentials.create()` as described in link:#getting-started[Getting started].
518+
519+
* Replace calls to the U2F
520+
link:https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-javascript-api-v1.2-ps-20170411.html#high-level-javascript-api[`sign`]
521+
method with calls to `navigator.credentials.get()` as described in link:#getting-started[Getting started].
522+
523+
Existing U2F credentials should now work with the WebAuthn API.
524+
525+
Note that new credentials registered on U2F authenticators via the WebAuthn API
526+
are NOT backwards compatible with the U2F JavaScript API.
527+
528+
465529
== Architecture
466530

467531
The library tries to place as few requirements on the overall application

0 commit comments

Comments
 (0)