Skip to content

Commit 4c3bde4

Browse files
committed
Copy tests of startRegistration hints from RelyingPartyV2 to RelyingParty
1 parent a67ac4a commit 4c3bde4

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

webauthn-server-core/src/test/scala/com/yubico/webauthn/RelyingPartyStartOperationSpec.scala

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,64 @@ class RelyingPartyStartOperationSpec
219219
}
220220
}
221221

222+
describe("allows setting the hints") {
223+
val rp = relyingParty(userId = userId)
224+
225+
it("to string values in the spec or not.") {
226+
val pkcco = rp.startRegistration(
227+
StartRegistrationOptions
228+
.builder()
229+
.user(userId)
230+
.hints("hej", "security-key", "hoj", "client-device", "hybrid")
231+
.build()
232+
)
233+
pkcco.getHints.asScala should equal(
234+
List(
235+
"hej",
236+
PublicKeyCredentialHint.SECURITY_KEY.getValue,
237+
"hoj",
238+
PublicKeyCredentialHint.CLIENT_DEVICE.getValue,
239+
PublicKeyCredentialHint.HYBRID.getValue,
240+
)
241+
)
242+
}
243+
244+
it("to PublicKeyCredentialHint values in the spec or not.") {
245+
val pkcco = rp.startRegistration(
246+
StartRegistrationOptions
247+
.builder()
248+
.user(userId)
249+
.hints(
250+
PublicKeyCredentialHint.of("hej"),
251+
PublicKeyCredentialHint.HYBRID,
252+
PublicKeyCredentialHint.SECURITY_KEY,
253+
PublicKeyCredentialHint.of("hoj"),
254+
PublicKeyCredentialHint.CLIENT_DEVICE,
255+
)
256+
.build()
257+
)
258+
pkcco.getHints.asScala should equal(
259+
List(
260+
"hej",
261+
PublicKeyCredentialHint.HYBRID.getValue,
262+
PublicKeyCredentialHint.SECURITY_KEY.getValue,
263+
"hoj",
264+
PublicKeyCredentialHint.CLIENT_DEVICE.getValue,
265+
)
266+
)
267+
}
268+
269+
it("or not, defaulting to the empty list.") {
270+
val pkcco = rp.startRegistration(
271+
StartRegistrationOptions
272+
.builder()
273+
.user(userId)
274+
.build()
275+
)
276+
pkcco.getHints.asScala should equal(List())
277+
}
278+
}
279+
222280
it("allows setting the timeout to empty.") {
223281
val pkcco = relyingParty(userId = userId).startRegistration(
224282
StartRegistrationOptions

0 commit comments

Comments
 (0)