Skip to content

Commit f5978a6

Browse files
committed
Add "hybrid" transport
1 parent 414baa4 commit f5978a6

File tree

5 files changed

+51
-9
lines changed

5 files changed

+51
-9
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ New features:
2727
some JCA providers to accept attestation certificates with critical
2828
certificate policy extensions. See the JavaDoc for
2929
`TrustRootsResultBuilder.policyTreeValidator(Predicate)` for more information.
30+
* (Experimental) Added constant `AuthenticatorTransport.HYBRID`.
3031

3132
Fixes:
3233

README

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ The library will log warnings if you try to configure it for algorithms with no
6060
This library uses link:https://semver.org/[semantic versioning].
6161
The public API consists of all public classes, methods and fields in the `com.yubico.webauthn` package and its subpackages,
6262
i.e., everything covered by the
63-
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core/2.0.0/com/yubico/webauthn/package-summary.html[Javadoc].
63+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-core/2.0.0/com/yubico/webauthn/package-summary.html[Javadoc],
64+
*with the exception* of things annotated with `@Deprecated`.
6465

6566
Package-private classes and methods are NOT part of the public API.
6667
The `com.yubico:yubico-util` module is NOT part of the public API.

webauthn-server-attestation/README.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ compile 'com.yubico:webauthn-server-attestation:2.0.0'
109109
This library uses link:https://semver.org/[semantic versioning].
110110
The public API consists of all public classes, methods and fields in the `com.yubico.fido.metadata` package and its subpackages,
111111
i.e., everything covered by the
112-
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-attestation/2.0.0/com/yubico/fido/metadata/package-summary.html[Javadoc].
112+
link:https://developers.yubico.com/java-webauthn-server/JavaDoc/webauthn-server-attestation/2.0.0/com/yubico/fido/metadata/package-summary.html[Javadoc],
113+
*with the exception* of things annotated with `@Deprecated`.
113114

114115
Package-private classes and methods are NOT part of the public API.
115116
The `com.yubico:yubico-util` module is NOT part of the public API.

webauthn-server-core/src/main/java/com/yubico/webauthn/data/AuthenticatorTransport.java

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,54 @@ public class AuthenticatorTransport implements Comparable<AuthenticatorTransport
5858

5959
@JsonValue @NonNull private final String id;
6060

61-
/** Indicates the respective authenticator can be contacted over removable USB. */
61+
/**
62+
* Indicates the respective authenticator can be contacted over removable USB.
63+
*
64+
* @see <a
65+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-authenticatortransport-usb">5.8.4.
66+
* Authenticator Transport Enumeration (enum AuthenticatorTransport)</a>
67+
*/
6268
public static final AuthenticatorTransport USB = new AuthenticatorTransport("usb");
6369

6470
/**
6571
* Indicates the respective authenticator can be contacted over Near Field Communication (NFC).
72+
*
73+
* @see <a
74+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-authenticatortransport-nfc">5.8.4.
75+
* Authenticator Transport Enumeration (enum AuthenticatorTransport)</a>
6676
*/
6777
public static final AuthenticatorTransport NFC = new AuthenticatorTransport("nfc");
6878

6979
/**
7080
* Indicates the respective authenticator can be contacted over Bluetooth Smart (Bluetooth Low
7181
* Energy / BLE).
82+
*
83+
* @see <a
84+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-authenticatortransport-ble">5.8.4.
85+
* Authenticator Transport Enumeration (enum AuthenticatorTransport)</a>
7286
*/
7387
public static final AuthenticatorTransport BLE = new AuthenticatorTransport("ble");
7488

89+
/**
90+
* Indicates the respective authenticator can be contacted using a combination of (often separate)
91+
* data-transport and proximity mechanisms. This supports, for example, authentication on a
92+
* desktop computer using a smartphone.
93+
*
94+
* @deprecated EXPERIMENTAL: This feature is from a not yet mature standard; it could change as
95+
* the standard matures.
96+
* @see <a href="https://w3c.github.io/webauthn/#dom-authenticatortransport-hybrid">5.8.4.
97+
* Authenticator Transport Enumeration (enum AuthenticatorTransport)</a>
98+
*/
99+
@Deprecated
100+
public static final AuthenticatorTransport HYBRID = new AuthenticatorTransport("hybrid");
101+
75102
/**
76103
* Indicates the respective authenticator is contacted using a client device-specific transport.
77104
* These authenticators are not removable from the client device.
105+
*
106+
* @see <a
107+
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-authenticatortransport-internal">5.8.4.
108+
* Authenticator Transport Enumeration (enum AuthenticatorTransport)</a>
78109
*/
79110
public static final AuthenticatorTransport INTERNAL = new AuthenticatorTransport("internal");
80111

@@ -83,13 +114,13 @@ public class AuthenticatorTransport implements Comparable<AuthenticatorTransport
83114
* this implementation.
84115
*/
85116
public static AuthenticatorTransport[] values() {
86-
return new AuthenticatorTransport[] {USB, NFC, BLE, INTERNAL};
117+
return new AuthenticatorTransport[] {USB, NFC, BLE, HYBRID, INTERNAL};
87118
}
88119

89120
/**
90121
* @return If <code>id</code> is the same as that of any of {@link #USB}, {@link #NFC}, {@link
91-
* #BLE} or {@link #INTERNAL}, returns that constant instance. Otherwise returns a new
92-
* instance containing <code>id</code>.
122+
* #BLE}, {@link #HYBRID} or {@link #INTERNAL}, returns that constant instance. Otherwise
123+
* returns a new instance containing <code>id</code>.
93124
* @see #valueOf(String)
94125
*/
95126
@JsonCreator
@@ -101,8 +132,8 @@ public static AuthenticatorTransport of(@NonNull String id) {
101132
}
102133

103134
/**
104-
* @return If <code>name</code> equals <code>"USB"</code>, <code>"NFC"</code>, <code>"BLE"</code>
105-
* or <code>"INTERNAL"</code>, returns the constant by that name.
135+
* @return If <code>name</code> equals <code>"USB"</code>, <code>"NFC"</code>, <code>"BLE"</code>,
136+
* <code>"HYBRID"</code> or <code>"INTERNAL"</code>, returns the constant by that name.
106137
* @throws IllegalArgumentException if <code>name</code> is anything else.
107138
* @see #of(String)
108139
*/
@@ -114,6 +145,8 @@ public static AuthenticatorTransport valueOf(String name) {
114145
return NFC;
115146
case "BLE":
116147
return BLE;
148+
case "HYBRID":
149+
return HYBRID;
117150
case "INTERNAL":
118151
return INTERNAL;
119152
default:

webauthn-server-core/src/test/scala/com/yubico/webauthn/data/AuthenticatorTransportSpec.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ class AuthenticatorTransportSpec
4848
it("BLE.") {
4949
AuthenticatorTransport.BLE.getId should equal("ble")
5050
}
51+
it("HYBRID.") {
52+
AuthenticatorTransport.HYBRID.getId should equal("hybrid")
53+
}
5154
it("INTERNAL.") {
5255
AuthenticatorTransport.INTERNAL.getId should equal("internal")
5356
}
5457
}
5558

5659
it("has a values() function.") {
57-
AuthenticatorTransport.values().length should equal(4)
60+
AuthenticatorTransport.values().length should equal(5)
5861
AuthenticatorTransport.values() should not be theSameInstanceAs(
5962
AuthenticatorTransport.values()
6063
)
@@ -70,6 +73,9 @@ class AuthenticatorTransportSpec
7073
AuthenticatorTransport.valueOf(
7174
"BLE"
7275
) should be theSameInstanceAs AuthenticatorTransport.BLE
76+
AuthenticatorTransport.valueOf(
77+
"HYBRID"
78+
) should be theSameInstanceAs AuthenticatorTransport.HYBRID
7379
AuthenticatorTransport.valueOf(
7480
"INTERNAL"
7581
) should be theSameInstanceAs AuthenticatorTransport.INTERNAL

0 commit comments

Comments
 (0)