@@ -164,6 +164,7 @@ class RelyingPartyRegistrationSpec
164
164
pubkeyCredParams : Option [List [PublicKeyCredentialParameters ]] = None ,
165
165
testData : RegistrationTestData ,
166
166
clock : Clock = Clock .systemUTC(),
167
+ isConditionalCreate : Boolean = false ,
167
168
): FinishRegistrationSteps = {
168
169
var builder = RelyingParty
169
170
.builder()
@@ -191,6 +192,7 @@ class RelyingPartyRegistrationSpec
191
192
)
192
193
.response(testData.response)
193
194
.callerTokenBindingId(callerTokenBindingId.toJava)
195
+ .isConditionalCreate(isConditionalCreate)
194
196
.build()
195
197
196
198
builder
@@ -873,6 +875,7 @@ class RelyingPartyRegistrationSpec
873
875
)(chk : Step => B )(
874
876
uvr : UserVerificationRequirement ,
875
877
authDataEdit : ByteArray => ByteArray ,
878
+ isConditionalCreate : Boolean ,
876
879
): B = {
877
880
val steps = finishRegistration(
878
881
testData = testData
@@ -884,14 +887,19 @@ class RelyingPartyRegistrationSpec
884
887
.build()
885
888
)
886
889
)
887
- .editAuthenticatorData(authDataEdit)
890
+ .editAuthenticatorData(authDataEdit),
891
+ isConditionalCreate = isConditionalCreate,
888
892
)
889
893
chk(stepsToStep(steps))
890
894
}
891
895
892
896
def checkFailsWith (
893
897
stepsToStep : FinishRegistrationSteps => Step
894
- ): (UserVerificationRequirement , ByteArray => ByteArray ) => Unit =
898
+ ): (
899
+ UserVerificationRequirement ,
900
+ ByteArray => ByteArray ,
901
+ Boolean ,
902
+ ) => Unit =
895
903
check(stepsToStep) { step =>
896
904
step.validations shouldBe a[Failure [_]]
897
905
step.validations.failed.get shouldBe an[
@@ -902,7 +910,11 @@ class RelyingPartyRegistrationSpec
902
910
903
911
def checkSucceedsWith (
904
912
stepsToStep : FinishRegistrationSteps => Step
905
- ): (UserVerificationRequirement , ByteArray => ByteArray ) => Unit =
913
+ ): (
914
+ UserVerificationRequirement ,
915
+ ByteArray => ByteArray ,
916
+ Boolean ,
917
+ ) => Unit =
906
918
check(stepsToStep) { step =>
907
919
step.validations shouldBe a[Success [_]]
908
920
step.tryNext shouldBe a[Success [_]]
@@ -912,15 +924,41 @@ class RelyingPartyRegistrationSpec
912
924
}
913
925
914
926
describe(" 14. Verify that the User Present bit of the flags in authData is set." ) {
915
- val (checkFails, checkSucceeds ) = checks[
927
+ val (chkf, chks ) = checks[
916
928
FinishRegistrationSteps # Step15 ,
917
929
FinishRegistrationSteps # Step14 ,
918
930
](_.begin.next.next.next.next.next.next.next.next)
931
+ def checkFails (
932
+ uvr : UserVerificationRequirement ,
933
+ authDataEdit : ByteArray => ByteArray ,
934
+ isConditionalCreate : Boolean = false ,
935
+ ): Unit = chkf(uvr, authDataEdit, isConditionalCreate)
936
+ def checkSucceeds (
937
+ uvr : UserVerificationRequirement ,
938
+ authDataEdit : ByteArray => ByteArray ,
939
+ isConditionalCreate : Boolean = false ,
940
+ ): Unit = chks(uvr, authDataEdit, isConditionalCreate)
919
941
920
942
it(" Fails if UV is discouraged and flag is not set." ) {
921
943
checkFails(UserVerificationRequirement .DISCOURAGED , upOff)
922
944
}
923
945
946
+ it(" Fails if UV is discouraged, isConditionalCreate is false and flag is not set." ) {
947
+ checkFails(
948
+ UserVerificationRequirement .DISCOURAGED ,
949
+ upOff,
950
+ isConditionalCreate = false ,
951
+ )
952
+ }
953
+
954
+ it(" Succeeds if UV is discouraged, isConditionalCreate is true and flag is not set." ) {
955
+ checkSucceeds(
956
+ UserVerificationRequirement .DISCOURAGED ,
957
+ upOff,
958
+ isConditionalCreate = true ,
959
+ )
960
+ }
961
+
924
962
it(" Succeeds if UV is discouraged and flag is set." ) {
925
963
checkSucceeds(UserVerificationRequirement .DISCOURAGED , upOn)
926
964
}
@@ -949,10 +987,20 @@ class RelyingPartyRegistrationSpec
949
987
}
950
988
951
989
describe(" 15. If user verification is required for this registration, verify that the User Verified bit of the flags in authData is set." ) {
952
- val (checkFails, checkSucceeds ) = checks[
990
+ val (chkf, chks ) = checks[
953
991
FinishRegistrationSteps # Step16 ,
954
992
FinishRegistrationSteps # Step15 ,
955
993
](_.begin.next.next.next.next.next.next.next.next.next)
994
+ def checkFails (
995
+ uvr : UserVerificationRequirement ,
996
+ authDataEdit : ByteArray => ByteArray ,
997
+ isConditionalCreate : Boolean = false ,
998
+ ): Unit = chkf(uvr, authDataEdit, isConditionalCreate)
999
+ def checkSucceeds (
1000
+ uvr : UserVerificationRequirement ,
1001
+ authDataEdit : ByteArray => ByteArray ,
1002
+ isConditionalCreate : Boolean = false ,
1003
+ ): Unit = chks(uvr, authDataEdit, isConditionalCreate)
956
1004
957
1005
it(" Succeeds if UV is discouraged and flag is not set." ) {
958
1006
checkSucceeds(UserVerificationRequirement .DISCOURAGED , uvOff)
0 commit comments