@@ -38,6 +38,7 @@ import com.yubico.webauthn.data.Generators.arbitraryAuthenticatorTransport
38
38
import com .yubico .webauthn .data .PublicKeyCredentialRequestOptions
39
39
import com .yubico .webauthn .data .RelyingPartyIdentity
40
40
import com .yubico .webauthn .data .ResidentKeyRequirement
41
+ import com .yubico .webauthn .test .RealExamples
41
42
import demo .webauthn .data .AssertionRequestWrapper
42
43
import demo .webauthn .data .CredentialRegistration
43
44
import demo .webauthn .data .RegistrationRequest
@@ -91,23 +92,27 @@ class WebAuthnServerSpec
91
92
}
92
93
93
94
it(" has a finish method which accepts and outputs JSON." ) {
94
- val requestId = ByteArray .fromBase64Url(" request1" )
95
-
96
- val server = newServerWithRegistrationRequest(
97
- RegistrationTestData .FidoU2f .BasicAttestation
98
- )
95
+ for {
96
+ testData <- List (
97
+ RegistrationTestData .FidoU2f .BasicAttestation , // This test case for no particular reason
98
+ RealExamples .LargeBlobWrite .asRegistrationTestData, // This test case because it has authenticator extensions
99
+ )
100
+ } {
101
+ val requestId = ByteArray .fromBase64Url(" request1" )
102
+ val server = newServerWithRegistrationRequest(testData)
99
103
100
- val authenticationAttestationResponseJson =
101
- """{"attestationObject":"v2hhdXRoRGF0YVikSZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2NBAAAFOQABAgMEBQYHCAkKCwwNDg8AIIjjhj6nH3qL2QF3tkUogilFykuaXjJTw35O4m-0NSX0pSJYIA5Nt8eYkLco-NQfKPXaA6dD9UfX_SHaYo-L-YQb78HsAyYBAiFYIOuzRl1o1Hem2jVRYhjkbSeIydhqLln9iltAgsDYjXRTIAFjZm10aGZpZG8tdTJmZ2F0dFN0bXS_Y3g1Y59ZAekwggHlMIIBjKADAgECAgIFOTAKBggqhkjOPQQDAjBqMSYwJAYDVQQDDB1ZdWJpY28gV2ViQXV0aG4gdW5pdCB0ZXN0cyBDQTEPMA0GA1UECgwGWXViaWNvMSIwIAYDVQQLDBlBdXRoZW50aWNhdG9yIEF0dGVzdGF0aW9uMQswCQYDVQQGEwJTRTAeFw0xODA5MDYxNzQyMDBaFw0xODA5MDYxNzQyMDBaMGcxIzAhBgNVBAMMGll1YmljbyBXZWJBdXRobiB1bml0IHRlc3RzMQ8wDQYDVQQKDAZZdWJpY28xIjAgBgNVBAsMGUF1dGhlbnRpY2F0b3IgQXR0ZXN0YXRpb24xCzAJBgNVBAYTAlNFMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJ-8bFED9TnFhaArujgB0foNaV4gQIulP1mC5DO1wvSByw4eOyXujpPHkTw9y5e5J2J3N9coSReZJgBRpvFzYD6MlMCMwIQYLKwYBBAGC5RwBAQQEEgQQAAECAwQFBgcICQoLDA0ODzAKBggqhkjOPQQDAgNHADBEAiB4bL25EH06vPBOVnReObXrS910ARVOLJPPnKNoZbe64gIgX1Rg5oydH45zEMEVDjNPStwv6Z3nE_isMeY-szlQhv3_Y3NpZ1hHMEUCIQDBs1nbSuuKQ6yoHMQoRp8eCT_HZvR45F_aVP6qFX_wKgIgMCL58bv-crkLwTwiEL9ibCV4nDYM-DZuW5_BFCJbcxn__w","clientDataJSON":"eyJjaGFsbGVuZ2UiOiJBQUVCQWdNRkNBMFZJamRaRUdsNVlscyIsIm9yaWdpbiI6ImxvY2FsaG9zdCIsInR5cGUiOiJ3ZWJhdXRobi5jcmVhdGUiLCJ0b2tlbkJpbmRpbmciOnsic3RhdHVzIjoic3VwcG9ydGVkIn19"}"""
102
- val publicKeyCredentialJson =
103
- s """ {"id":"iOOGPqcfeovZAXe2RSiCKUXKS5peMlPDfk7ib7Q1JfQ ","response": ${authenticationAttestationResponseJson},"clientExtensionResults":{},"type":"public-key"} """
104
- val responseJson =
105
- s """ {"requestId":" ${requestId.getBase64Url}","credential": ${publicKeyCredentialJson}} """
104
+ val authenticationAttestationResponseJson =
105
+ s """ {"attestationObject":" ${testData.attestationObject.getBase64Url}","clientDataJSON":" ${testData.clientDataJsonBytes.getBase64Url}"} """
106
+ val publicKeyCredentialJson =
107
+ s """ {"id":" ${testData.response.getId.getBase64Url} ","response": ${authenticationAttestationResponseJson},"clientExtensionResults":{},"type":"public-key"} """
108
+ val responseJson =
109
+ s """ {"requestId":" ${requestId.getBase64Url}","credential": ${publicKeyCredentialJson}} """
106
110
107
- val response = server.finishRegistration(responseJson)
108
- val json = jsonMapper.writeValueAsString(response.right.get)
111
+ val response = server.finishRegistration(responseJson)
112
+ val json = jsonMapper.writeValueAsString(response.right.get)
109
113
110
- json should not be null
114
+ json should not be null
115
+ }
111
116
}
112
117
113
118
}
@@ -393,8 +398,8 @@ class WebAuthnServerSpec
393
398
new InMemoryRegistrationStorage ,
394
399
registrationRequests,
395
400
newCache(),
396
- rpId,
397
- origins ,
401
+ testData. rpId,
402
+ Set (testData.response.getResponse.getClientData.getOrigin).asJava ,
398
403
)
399
404
}
400
405
0 commit comments