@@ -33,6 +33,9 @@ import com.yubico.webauthn.attestation.resolver.SimpleTrustResolver
3333import com .yubico .webauthn .test .RealExamples
3434import com .yubico .webauthn .FinishRegistrationOptions
3535import com .yubico .webauthn .RelyingParty
36+ import com .yubico .webauthn .attestation .Transport .LIGHTNING
37+ import com .yubico .webauthn .attestation .Transport .NFC
38+ import com .yubico .webauthn .attestation .Transport .USB
3639import com .yubico .webauthn .data .PublicKeyCredentialCreationOptions
3740import com .yubico .webauthn .data .PublicKeyCredentialParameters
3841import com .yubico .webauthn .test .Helpers
@@ -57,7 +60,7 @@ class DeviceIdentificationSpec extends FunSpec with Matchers {
5760 describe(" A RelyingParty with the default StandardMetadataService" ) {
5861
5962 describe(" correctly identifies" ) {
60- def check (expectedName : String , testData : RealExamples .Example ) {
63+ def check (expectedName : String , testData : RealExamples .Example , transports : Set [ Transport ] ) {
6164 val rp = RelyingParty .builder()
6265 .identity(testData.rp)
6366 .credentialRepository(Helpers .CredentialRepository .empty)
@@ -78,62 +81,72 @@ class DeviceIdentificationSpec extends FunSpec with Matchers {
7881 result.getAttestationMetadata.isPresent should be (true )
7982 result.getAttestationMetadata.get.getDeviceProperties.isPresent should be (true )
8083 result.getAttestationMetadata.get.getDeviceProperties.get().get(" displayName" ) should equal (expectedName)
84+ result.getAttestationMetadata.get.getTransports.isPresent should be (true )
85+ result.getAttestationMetadata.get.getTransports.get.asScala should equal (transports)
8186 }
8287
8388 it(" a YubiKey NEO." ) {
84- check(" YubiKey NEO/NEO-n" , RealExamples .YubiKeyNeo )
89+ check(" YubiKey NEO/NEO-n" , RealExamples .YubiKeyNeo , Set ( USB , NFC ) )
8590 }
8691 it(" a YubiKey 4." ) {
87- check(" YubiKey 4/YubiKey 4 Nano" , RealExamples .YubiKey4 )
92+ check(" YubiKey 4/YubiKey 4 Nano" , RealExamples .YubiKey4 , Set ( USB ) )
8893 }
8994 it(" a YubiKey 5 NFC." ) {
90- check(" YubiKey 5 NFC" , RealExamples .YubiKey5 )
95+ check(" YubiKey 5 NFC" , RealExamples .YubiKey5 , Set ( USB , NFC ) )
9196 }
9297 it(" a YubiKey 5 Nano." ) {
93- check(" YubiKey 5 Series security key" , RealExamples .YubiKey5Nano )
98+ check(" YubiKey 5 Series security key" , RealExamples .YubiKey5Nano , Set (USB ))
99+ }
100+ it(" a YubiKey 5Ci." ) {
101+ check(" YubiKey 5Ci" , RealExamples .YubiKey5Ci , Set (USB , LIGHTNING ))
94102 }
95103 it(" a Security Key by Yubico." ) {
96- check(" Security Key by Yubico" , RealExamples .SecurityKey )
104+ check(" Security Key by Yubico" , RealExamples .SecurityKey , Set ( USB ) )
97105 }
98106 it(" a Security Key 2 by Yubico." ) {
99- check(" Security Key by Yubico" , RealExamples .SecurityKey2 )
107+ check(" Security Key by Yubico" , RealExamples .SecurityKey2 , Set ( USB ) )
100108 }
101109 it(" a Security Key NFC by Yubico." ) {
102- check(" Security Key NFC by Yubico" , RealExamples .SecurityKeyNfc )
110+ check(" Security Key NFC by Yubico" , RealExamples .SecurityKeyNfc , Set ( USB , NFC ) )
103111 }
104112 }
105113 }
106114
107115 describe(" The default AttestationResolver" ) {
108116 describe(" successfully identifies" ) {
109- def check (expectedName : String , testData : RealExamples .Example ) {
117+ def check (expectedName : String , testData : RealExamples .Example , transports : Set [ Transport ] ) {
110118 val cert = CertificateParser .parseDer(testData.attestationCert.getBytes)
111119 val resolved = StandardMetadataService .createDefaultAttestationResolver().resolve(cert)
112120 resolved.isPresent should be (true )
113121 resolved.get.getDeviceProperties.isPresent should be (true )
114122 resolved.get.getDeviceProperties.get.get(" displayName" ) should equal (expectedName)
123+ resolved.get.getTransports.isPresent should be (true )
124+ resolved.get.getTransports.get.asScala should equal (transports)
115125 }
116126
117127 it(" a YubiKey NEO." ) {
118- check(" YubiKey NEO/NEO-n" , RealExamples .YubiKeyNeo )
128+ check(" YubiKey NEO/NEO-n" , RealExamples .YubiKeyNeo , Set ( USB , NFC ) )
119129 }
120130 it(" a YubiKey 4." ) {
121- check(" YubiKey 4/YubiKey 4 Nano" , RealExamples .YubiKey4 )
131+ check(" YubiKey 4/YubiKey 4 Nano" , RealExamples .YubiKey4 , Set ( USB ) )
122132 }
123133 it(" a YubiKey 5 NFC." ) {
124- check(" YubiKey 5 NFC" , RealExamples .YubiKey5 )
134+ check(" YubiKey 5 NFC" , RealExamples .YubiKey5 , Set ( USB , NFC ) )
125135 }
126136 it(" a YubiKey 5 Nano." ) {
127- check(" YubiKey 5 Series security key" , RealExamples .YubiKey5Nano )
137+ check(" YubiKey 5 Series security key" , RealExamples .YubiKey5Nano , Set (USB ))
138+ }
139+ it(" a YubiKey 5Ci." ) {
140+ check(" YubiKey 5Ci" , RealExamples .YubiKey5Ci , Set (USB , LIGHTNING ))
128141 }
129142 it(" a Security Key by Yubico." ) {
130- check(" Security Key by Yubico" , RealExamples .SecurityKey )
143+ check(" Security Key by Yubico" , RealExamples .SecurityKey , Set ( USB ) )
131144 }
132145 it(" a Security Key 2 by Yubico." ) {
133- check(" Security Key by Yubico" , RealExamples .SecurityKey2 )
146+ check(" Security Key by Yubico" , RealExamples .SecurityKey2 , Set ( USB ) )
134147 }
135148 it(" a Security Key NFC by Yubico." ) {
136- check(" Security Key NFC by Yubico" , RealExamples .SecurityKeyNfc )
149+ check(" Security Key NFC by Yubico" , RealExamples .SecurityKeyNfc , Set ( USB , NFC ) )
137150 }
138151 }
139152 }
0 commit comments