Skip to content

Commit a269d19

Browse files
committed
Add public builder to CredentialPropertiesOutput
1 parent 68b6988 commit a269d19

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ New features:
66
`RegistrationResult` and `RegisteredCredential`.
77
** Thanks to Jakob Heher (A-SIT) for the contribution, see
88
https://github.com/Yubico/java-webauthn-server/pull/299
9+
* Added public builder to `CredentialPropertiesOutput`.
910
* (Experimental) Added option `isSecurePaymentConfirmation(boolean)` to
1011
`FinishAssertionOptions`. When set, `RelyingParty.finishAssertion()` will
1112
adapt the validation logic for a Secure Payment Confirmation (SPC) response

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.Set;
1515
import java.util.stream.Collectors;
1616
import java.util.stream.Stream;
17+
import lombok.Builder;
1718
import lombok.NonNull;
1819
import lombok.Value;
1920
import lombok.experimental.UtilityClass;
@@ -63,12 +64,13 @@ public static class CredentialProperties {
6364
* Credential Properties Extension (credProps)</a>
6465
*/
6566
@Value
67+
@Builder
6668
public static class CredentialPropertiesOutput {
6769
@JsonProperty("rk")
6870
private final Boolean rk;
6971

7072
@JsonCreator
71-
CredentialPropertiesOutput(@JsonProperty("rk") Boolean rk) {
73+
private CredentialPropertiesOutput(@JsonProperty("rk") Boolean rk) {
7274
this.rk = rk;
7375
}
7476

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ import com.yubico.webauthn.data.ByteArray
5252
import com.yubico.webauthn.data.COSEAlgorithmIdentifier
5353
import com.yubico.webauthn.data.ClientRegistrationExtensionOutputs
5454
import com.yubico.webauthn.data.CollectedClientData
55+
import com.yubico.webauthn.data.Extensions.CredentialProperties.CredentialPropertiesOutput
5556
import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobRegistrationInput.LargeBlobSupport
5657
import com.yubico.webauthn.data.Extensions.Uvm.UvmEntry
5758
import com.yubico.webauthn.data.Generators._
5859
import com.yubico.webauthn.data.PublicKeyCredential
5960
import com.yubico.webauthn.data.PublicKeyCredentialCreationOptions
6061
import com.yubico.webauthn.data.PublicKeyCredentialParameters
6162
import com.yubico.webauthn.data.ReexportHelpers
62-
import com.yubico.webauthn.data.ReexportHelpers.newCredentialPropertiesOutput
6363
import com.yubico.webauthn.data.RegistrationExtensionInputs
6464
import com.yubico.webauthn.data.RelyingPartyIdentity
6565
import com.yubico.webauthn.data.UserIdentity
@@ -4232,7 +4232,7 @@ class RelyingPartyRegistrationSpec
42324232
ClientRegistrationExtensionOutputs
42334233
.builder()
42344234
.credProps(
4235-
newCredentialPropertiesOutput(true)
4235+
CredentialPropertiesOutput.builder().rk(true).build()
42364236
)
42374237
.build()
42384238
)
@@ -4255,7 +4255,7 @@ class RelyingPartyRegistrationSpec
42554255
ClientRegistrationExtensionOutputs
42564256
.builder()
42574257
.credProps(
4258-
newCredentialPropertiesOutput(false)
4258+
CredentialPropertiesOutput.builder().rk(false).build()
42594259
)
42604260
.build()
42614261
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ import com.yubico.webauthn.data.ByteArray
5252
import com.yubico.webauthn.data.COSEAlgorithmIdentifier
5353
import com.yubico.webauthn.data.ClientRegistrationExtensionOutputs
5454
import com.yubico.webauthn.data.CollectedClientData
55+
import com.yubico.webauthn.data.Extensions.CredentialProperties.CredentialPropertiesOutput
5556
import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobRegistrationInput.LargeBlobSupport
5657
import com.yubico.webauthn.data.Extensions.Uvm.UvmEntry
5758
import com.yubico.webauthn.data.Generators._
5859
import com.yubico.webauthn.data.PublicKeyCredential
5960
import com.yubico.webauthn.data.PublicKeyCredentialCreationOptions
6061
import com.yubico.webauthn.data.PublicKeyCredentialParameters
6162
import com.yubico.webauthn.data.ReexportHelpers
62-
import com.yubico.webauthn.data.ReexportHelpers.newCredentialPropertiesOutput
6363
import com.yubico.webauthn.data.RegistrationExtensionInputs
6464
import com.yubico.webauthn.data.RelyingPartyIdentity
6565
import com.yubico.webauthn.data.UserIdentity
@@ -4227,7 +4227,7 @@ class RelyingPartyV2RegistrationSpec
42274227
ClientRegistrationExtensionOutputs
42284228
.builder()
42294229
.credProps(
4230-
newCredentialPropertiesOutput(true)
4230+
CredentialPropertiesOutput.builder().rk(true).build()
42314231
)
42324232
.build()
42334233
)
@@ -4250,7 +4250,7 @@ class RelyingPartyV2RegistrationSpec
42504250
ClientRegistrationExtensionOutputs
42514251
.builder()
42524252
.credProps(
4253-
newCredentialPropertiesOutput(false)
4253+
CredentialPropertiesOutput.builder().rk(false).build()
42544254
)
42554255
.build()
42564256
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ object Generators {
868868
def credentialPropertiesOutput: Gen[CredentialPropertiesOutput] =
869869
for {
870870
rk <- arbitrary[Boolean]
871-
} yield new CredentialPropertiesOutput(rk)
871+
} yield CredentialPropertiesOutput.builder().rk(rk).build()
872872
}
873873

874874
object LargeBlob {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.yubico.webauthn.data
22

3-
import com.yubico.webauthn.data.Extensions.CredentialProperties.CredentialPropertiesOutput
43
import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobAuthenticationOutput
54
import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobRegistrationOutput
65

@@ -10,9 +9,6 @@ import com.yubico.webauthn.data.Extensions.LargeBlob.LargeBlobRegistrationOutput
109
*/
1110
object ReexportHelpers {
1211

13-
def newCredentialPropertiesOutput(rk: Boolean): CredentialPropertiesOutput =
14-
new CredentialPropertiesOutput(rk)
15-
1612
def newLargeBlobRegistrationOutput(
1713
supported: Boolean
1814
): LargeBlobRegistrationOutput = new LargeBlobRegistrationOutput(supported)

0 commit comments

Comments
 (0)