| 1 | // Copyright (c) 2018, Yubico AB | |
| 2 | // All rights reserved. | |
| 3 | // | |
| 4 | // Redistribution and use in source and binary forms, with or without | |
| 5 | // modification, are permitted provided that the following conditions are met: | |
| 6 | // | |
| 7 | // 1. Redistributions of source code must retain the above copyright notice, this | |
| 8 | // list of conditions and the following disclaimer. | |
| 9 | // | |
| 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, | |
| 11 | // this list of conditions and the following disclaimer in the documentation | |
| 12 | // and/or other materials provided with the distribution. | |
| 13 | // | |
| 14 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 15 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 17 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
| 18 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 20 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
| 21 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 22 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 | ||
| 25 | package com.yubico.webauthn; | |
| 26 | ||
| 27 | import com.fasterxml.jackson.annotation.JsonCreator; | |
| 28 | import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 29 | import com.fasterxml.jackson.annotation.JsonProperty; | |
| 30 | import com.yubico.internal.util.CertificateParser; | |
| 31 | import com.yubico.webauthn.RelyingParty.RelyingPartyBuilder; | |
| 32 | import com.yubico.webauthn.attestation.AttestationTrustSource; | |
| 33 | import com.yubico.webauthn.data.AttestationType; | |
| 34 | import com.yubico.webauthn.data.AuthenticatorAttachment; | |
| 35 | import com.yubico.webauthn.data.AuthenticatorAttestationResponse; | |
| 36 | import com.yubico.webauthn.data.AuthenticatorData; | |
| 37 | import com.yubico.webauthn.data.AuthenticatorDataFlags; | |
| 38 | import com.yubico.webauthn.data.AuthenticatorRegistrationExtensionOutputs; | |
| 39 | import com.yubico.webauthn.data.AuthenticatorResponse; | |
| 40 | import com.yubico.webauthn.data.ByteArray; | |
| 41 | import com.yubico.webauthn.data.ClientRegistrationExtensionOutputs; | |
| 42 | import com.yubico.webauthn.data.Extensions; | |
| 43 | import com.yubico.webauthn.data.PublicKeyCredential; | |
| 44 | import com.yubico.webauthn.data.PublicKeyCredentialDescriptor; | |
| 45 | import com.yubico.webauthn.data.RegistrationExtensionInputs; | |
| 46 | import java.io.IOException; | |
| 47 | import java.security.NoSuchAlgorithmException; | |
| 48 | import java.security.PublicKey; | |
| 49 | import java.security.cert.CertificateEncodingException; | |
| 50 | import java.security.cert.CertificateException; | |
| 51 | import java.security.cert.X509Certificate; | |
| 52 | import java.security.spec.InvalidKeySpecException; | |
| 53 | import java.util.List; | |
| 54 | import java.util.Optional; | |
| 55 | import java.util.stream.Collectors; | |
| 56 | import lombok.AccessLevel; | |
| 57 | import lombok.Getter; | |
| 58 | import lombok.NonNull; | |
| 59 | import lombok.Value; | |
| 60 | ||
| 61 | /** The result of a call to {@link RelyingParty#finishRegistration(FinishRegistrationOptions)}. */ | |
| 62 | @Value | |
| 63 | public class RegistrationResult { | |
| 64 | ||
| 65 | @JsonProperty | |
| 66 | @Getter(AccessLevel.NONE) | |
| 67 | private final PublicKeyCredential< | |
| 68 | AuthenticatorAttestationResponse, ClientRegistrationExtensionOutputs> | |
| 69 | credential; | |
| 70 | ||
| 71 | /** | |
| 72 | * <code>true</code> if and only if the attestation signature was successfully linked to a trusted | |
| 73 | * attestation root. | |
| 74 | * | |
| 75 | * <p>This will always be <code>false</code> unless the {@link | |
| 76 | * RelyingPartyBuilder#attestationTrustSource(AttestationTrustSource) attestationTrustSource} | |
| 77 | * setting was configured on the {@link RelyingParty} instance. | |
| 78 | * | |
| 79 | * <p>You can ignore this if authenticator attestation is not relevant to your application. | |
| 80 | */ | |
| 81 | private final boolean attestationTrusted; | |
| 82 | ||
| 83 | /** | |
| 84 | * The <a | |
| 85 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-attestation-types">attestation | |
| 86 | * type</a> that was used for the created credential. | |
| 87 | * | |
| 88 | * <p>You can ignore this if authenticator attestation is not relevant to your application. | |
| 89 | * | |
| 90 | * @see <a | |
| 91 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-attestation-types">§6.4.3. | |
| 92 | * Attestation Types</a> | |
| 93 | */ | |
| 94 | @NonNull private final AttestationType attestationType; | |
| 95 | ||
| 96 | // JavaDoc on getter | |
| 97 | private final List<X509Certificate> attestationTrustPath; | |
| 98 | ||
| 99 | RegistrationResult( | |
| 100 | PublicKeyCredential<AuthenticatorAttestationResponse, ClientRegistrationExtensionOutputs> | |
| 101 | credential, | |
| 102 | boolean attestationTrusted, | |
| 103 |
1
1. <init> : negated conditional → KILLED |
@NonNull AttestationType attestationType, |
| 104 | Optional<List<X509Certificate>> attestationTrustPath) { | |
| 105 | this.credential = credential; | |
| 106 | this.attestationTrusted = attestationTrusted; | |
| 107 | this.attestationType = attestationType; | |
| 108 | this.attestationTrustPath = attestationTrustPath.orElse(null); | |
| 109 | } | |
| 110 | ||
| 111 | @JsonCreator | |
| 112 | private static RegistrationResult fromJson( | |
| 113 |
1
1. fromJson : negated conditional → KILLED |
@NonNull @JsonProperty("credential") |
| 114 | PublicKeyCredential<AuthenticatorAttestationResponse, ClientRegistrationExtensionOutputs> | |
| 115 | credential, | |
| 116 | @JsonProperty("attestationTrusted") boolean attestationTrusted, | |
| 117 |
1
1. fromJson : negated conditional → KILLED |
@NonNull @JsonProperty("attestationType") AttestationType attestationType, |
| 118 |
1
1. fromJson : negated conditional → KILLED |
@NonNull @JsonProperty("attestationTrustPath") Optional<List<String>> attestationTrustPath) { |
| 119 |
1
1. fromJson : replaced return value with null for com/yubico/webauthn/RegistrationResult::fromJson → KILLED |
return new RegistrationResult( |
| 120 | credential, | |
| 121 | attestationTrusted, | |
| 122 | attestationType, | |
| 123 | attestationTrustPath.map( | |
| 124 | atp -> | |
| 125 | atp.stream() | |
| 126 | .map( | |
| 127 | pem -> { | |
| 128 | try { | |
| 129 |
1
1. lambda$fromJson$0 : replaced return value with null for com/yubico/webauthn/RegistrationResult::lambda$fromJson$0 → KILLED |
return CertificateParser.parsePem(pem); |
| 130 | } catch (CertificateException e) { | |
| 131 | throw new RuntimeException(e); | |
| 132 | } | |
| 133 | }) | |
| 134 |
1
1. lambda$fromJson$1 : replaced return value with Collections.emptyList for com/yubico/webauthn/RegistrationResult::lambda$fromJson$1 → KILLED |
.collect(Collectors.toList()))); |
| 135 | } | |
| 136 | ||
| 137 | /** | |
| 138 | * Check whether the <a href="https://www.w3.org/TR/webauthn/#user-verification">user | |
| 139 | * verification</a> as performed during the registration ceremony. | |
| 140 | * | |
| 141 | * <p>This flag is also available via <code> | |
| 142 | * {@link PublicKeyCredential}.{@link PublicKeyCredential#getResponse() getResponse()}.{@link AuthenticatorResponse#getParsedAuthenticatorData() getParsedAuthenticatorData()}.{@link AuthenticatorData#getFlags() getFlags()}.{@link AuthenticatorDataFlags#UV UV} | |
| 143 | * </code>. | |
| 144 | * | |
| 145 | * @return <code>true</code> if and only if the authenticator claims to have performed user | |
| 146 | * verification during the registration ceremony. | |
| 147 | * @see <a href="https://www.w3.org/TR/webauthn/#user-verification">User Verification</a> | |
| 148 | * @see <a href="https://w3c.github.io/webauthn/#authdata-flags-uv">UV flag in §6.1. Authenticator | |
| 149 | * Data</a> | |
| 150 | */ | |
| 151 | @JsonIgnore | |
| 152 | public boolean isUserVerified() { | |
| 153 |
2
1. isUserVerified : replaced boolean return with false for com/yubico/webauthn/RegistrationResult::isUserVerified → KILLED 2. isUserVerified : replaced boolean return with true for com/yubico/webauthn/RegistrationResult::isUserVerified → KILLED |
return credential.getResponse().getParsedAuthenticatorData().getFlags().UV; |
| 154 | } | |
| 155 | ||
| 156 | /** | |
| 157 | * Check whether the created credential is <a | |
| 158 | * href="https://w3c.github.io/webauthn/#backup-eligible">backup eligible</a>, using the <a | |
| 159 | * href="https://w3c.github.io/webauthn/#authdata-flags-be">BE flag</a> in the authenticator data. | |
| 160 | * | |
| 161 | * <p>You SHOULD store this value in your representation of a {@link RegisteredCredential}. {@link | |
| 162 | * CredentialRepository} implementations SHOULD set this value as the {@link | |
| 163 | * RegisteredCredential.RegisteredCredentialBuilder#backupEligible(Boolean) | |
| 164 | * backupEligible(Boolean)} value when reconstructing that {@link RegisteredCredential}. | |
| 165 | * | |
| 166 | * @return <code>true</code> if and only if the created credential is backup eligible. NOTE that | |
| 167 | * this is only a hint and not a guarantee, unless backed by a trusted authenticator | |
| 168 | * attestation. | |
| 169 | * @see <a href="https://w3c.github.io/webauthn/#backup-eligible">Backup Eligible in §4. | |
| 170 | * Terminology</a> | |
| 171 | * @see <a href="https://w3c.github.io/webauthn/#authdata-flags-be">BE flag in §6.1. Authenticator | |
| 172 | * Data</a> | |
| 173 | * @deprecated EXPERIMENTAL: This feature is from a not yet mature standard; it could change as | |
| 174 | * the standard matures. | |
| 175 | */ | |
| 176 | @Deprecated | |
| 177 | @JsonIgnore | |
| 178 | public boolean isBackupEligible() { | |
| 179 |
2
1. isBackupEligible : replaced boolean return with true for com/yubico/webauthn/RegistrationResult::isBackupEligible → KILLED 2. isBackupEligible : replaced boolean return with false for com/yubico/webauthn/RegistrationResult::isBackupEligible → KILLED |
return credential.getResponse().getParsedAuthenticatorData().getFlags().BE; |
| 180 | } | |
| 181 | ||
| 182 | /** | |
| 183 | * Get the current <a href="https://w3c.github.io/webauthn/#backup-state">backup state</a> of the | |
| 184 | * created credential, using the <a href="https://w3c.github.io/webauthn/#authdata-flags-bs">BS | |
| 185 | * flag</a> in the authenticator data. | |
| 186 | * | |
| 187 | * <p>You SHOULD store this value in your representation of a {@link RegisteredCredential}. {@link | |
| 188 | * CredentialRepository} implementations SHOULD set this value as the {@link | |
| 189 | * RegisteredCredential.RegisteredCredentialBuilder#backupState(Boolean) backupState(Boolean)} | |
| 190 | * value when reconstructing that {@link RegisteredCredential}. | |
| 191 | * | |
| 192 | * @return <code>true</code> if and only if the created credential is believed to currently be | |
| 193 | * backed up. NOTE that this is only a hint and not a guarantee, unless backed by a trusted | |
| 194 | * authenticator attestation. | |
| 195 | * @see <a href="https://w3c.github.io/webauthn/#backup-state">Backup State in §4. Terminology</a> | |
| 196 | * @see <a href="https://w3c.github.io/webauthn/#authdata-flags-bs">BS flag in §6.1. Authenticator | |
| 197 | * Data</a> | |
| 198 | * @deprecated EXPERIMENTAL: This feature is from a not yet mature standard; it could change as | |
| 199 | * the standard matures. | |
| 200 | */ | |
| 201 | @Deprecated | |
| 202 | @JsonIgnore | |
| 203 | public boolean isBackedUp() { | |
| 204 |
2
1. isBackedUp : replaced boolean return with true for com/yubico/webauthn/RegistrationResult::isBackedUp → KILLED 2. isBackedUp : replaced boolean return with false for com/yubico/webauthn/RegistrationResult::isBackedUp → KILLED |
return credential.getResponse().getParsedAuthenticatorData().getFlags().BS; |
| 205 | } | |
| 206 | ||
| 207 | /** | |
| 208 | * The <a href="https://w3c.github.io/webauthn/#authenticator-attachment-modality">authenticator | |
| 209 | * attachment modality</a> in effect at the time the credential was created. | |
| 210 | * | |
| 211 | * @see PublicKeyCredential#getAuthenticatorAttachment() | |
| 212 | * @deprecated EXPERIMENTAL: This feature is from a not yet mature standard; it could change as | |
| 213 | * the standard matures. | |
| 214 | */ | |
| 215 | @Deprecated | |
| 216 | @JsonIgnore | |
| 217 | public Optional<AuthenticatorAttachment> getAuthenticatorAttachment() { | |
| 218 |
1
1. getAuthenticatorAttachment : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getAuthenticatorAttachment → KILLED |
return credential.getAuthenticatorAttachment(); |
| 219 | } | |
| 220 | ||
| 221 | /** | |
| 222 | * The signature count returned with the created credential. | |
| 223 | * | |
| 224 | * <p>This is used in {@link RelyingParty#finishAssertion(FinishAssertionOptions)} to verify the | |
| 225 | * validity of future signature counter values. | |
| 226 | * | |
| 227 | * @see RegisteredCredential#getSignatureCount() | |
| 228 | */ | |
| 229 | @JsonIgnore | |
| 230 | public long getSignatureCount() { | |
| 231 |
1
1. getSignatureCount : replaced long return with 0 for com/yubico/webauthn/RegistrationResult::getSignatureCount → KILLED |
return credential.getResponse().getParsedAuthenticatorData().getSignatureCounter(); |
| 232 | } | |
| 233 | ||
| 234 | /** | |
| 235 | * The <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#credential-id">credential | |
| 236 | * ID</a> and <a | |
| 237 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-publickeycredentialdescriptor-transports">transports</a> | |
| 238 | * of the created credential. | |
| 239 | * | |
| 240 | * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#credential-id">Credential | |
| 241 | * ID</a> | |
| 242 | * @see <a | |
| 243 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dictionary-credential-descriptor">5.8.3. | |
| 244 | * Credential Descriptor (dictionary PublicKeyCredentialDescriptor)</a> | |
| 245 | * @see PublicKeyCredential#getId() | |
| 246 | */ | |
| 247 | @JsonIgnore | |
| 248 | public PublicKeyCredentialDescriptor getKeyId() { | |
| 249 |
1
1. getKeyId : replaced return value with null for com/yubico/webauthn/RegistrationResult::getKeyId → KILLED |
return PublicKeyCredentialDescriptor.builder() |
| 250 | .id(credential.getId()) | |
| 251 | .type(credential.getType()) | |
| 252 | .transports(credential.getResponse().getTransports()) | |
| 253 | .build(); | |
| 254 | } | |
| 255 | ||
| 256 | /** | |
| 257 | * The <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#aaguid"><code>aaguid</code> | |
| 258 | * </a> reported in the <a | |
| 259 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-authenticator-data">of the | |
| 260 | * created credential.</a> | |
| 261 | * | |
| 262 | * <p>This MAY be an AAGUID consisting of only zeroes. | |
| 263 | */ | |
| 264 | @JsonIgnore | |
| 265 | public ByteArray getAaguid() { | |
| 266 |
1
1. getAaguid : replaced return value with null for com/yubico/webauthn/RegistrationResult::getAaguid → KILLED |
return credential |
| 267 | .getResponse() | |
| 268 | .getAttestation() | |
| 269 | .getAuthenticatorData() | |
| 270 | .getAttestedCredentialData() | |
| 271 | .get() | |
| 272 | .getAaguid(); | |
| 273 | } | |
| 274 | ||
| 275 | /** | |
| 276 | * The public key of the created credential. | |
| 277 | * | |
| 278 | * <p>This is used in {@link RelyingParty#finishAssertion(FinishAssertionOptions)} to verify the | |
| 279 | * authentication signatures. | |
| 280 | * | |
| 281 | * @see RegisteredCredential#getPublicKeyCose() | |
| 282 | */ | |
| 283 | @JsonIgnore | |
| 284 | public ByteArray getPublicKeyCose() { | |
| 285 |
1
1. getPublicKeyCose : replaced return value with null for com/yubico/webauthn/RegistrationResult::getPublicKeyCose → KILLED |
return credential |
| 286 | .getResponse() | |
| 287 | .getAttestation() | |
| 288 | .getAuthenticatorData() | |
| 289 | .getAttestedCredentialData() | |
| 290 | .get() | |
| 291 | .getCredentialPublicKey(); | |
| 292 | } | |
| 293 | ||
| 294 | /** | |
| 295 | * The public key of the created credential, parsed as a {@link PublicKey} object. | |
| 296 | * | |
| 297 | * @see #getPublicKeyCose() | |
| 298 | * @see RegisteredCredential#getParsedPublicKey() | |
| 299 | */ | |
| 300 | @NonNull | |
| 301 | @JsonIgnore | |
| 302 | public PublicKey getParsedPublicKey() | |
| 303 | throws InvalidKeySpecException, NoSuchAlgorithmException, IOException { | |
| 304 |
1
1. getParsedPublicKey : replaced return value with null for com/yubico/webauthn/RegistrationResult::getParsedPublicKey → NO_COVERAGE |
return WebAuthnCodecs.importCosePublicKey(getPublicKeyCose()); |
| 305 | } | |
| 306 | ||
| 307 | /** | |
| 308 | * The <a | |
| 309 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#client-extension-output">client | |
| 310 | * extension outputs</a>, if any. | |
| 311 | * | |
| 312 | * <p>This is present if and only if at least one extension output is present in the return value. | |
| 313 | * | |
| 314 | * @see <a | |
| 315 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-client-extension-processing">§9.4. | |
| 316 | * Client Extension Processing</a> | |
| 317 | * @see ClientRegistrationExtensionOutputs | |
| 318 | * @see #getAuthenticatorExtensionOutputs() () | |
| 319 | */ | |
| 320 | @JsonIgnore | |
| 321 | public Optional<ClientRegistrationExtensionOutputs> getClientExtensionOutputs() { | |
| 322 |
1
1. getClientExtensionOutputs : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getClientExtensionOutputs → KILLED |
return Optional.ofNullable(credential.getClientExtensionResults()) |
| 323 |
2
1. lambda$getClientExtensionOutputs$2 : replaced boolean return with true for com/yubico/webauthn/RegistrationResult::lambda$getClientExtensionOutputs$2 → SURVIVED 2. lambda$getClientExtensionOutputs$2 : negated conditional → KILLED |
.filter(ceo -> !ceo.getExtensionIds().isEmpty()); |
| 324 | } | |
| 325 | ||
| 326 | /** | |
| 327 | * The <a | |
| 328 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#authenticator-extension-output">authenticator | |
| 329 | * extension outputs</a>, if any. | |
| 330 | * | |
| 331 | * <p>This is present if and only if at least one extension output is present in the return value. | |
| 332 | * | |
| 333 | * @see <a | |
| 334 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-authenticator-extension-processing">§9.5. | |
| 335 | * Authenticator Extension Processing</a> | |
| 336 | * @see AuthenticatorRegistrationExtensionOutputs | |
| 337 | * @see #getClientExtensionOutputs() | |
| 338 | */ | |
| 339 | @JsonIgnore | |
| 340 | public Optional<AuthenticatorRegistrationExtensionOutputs> getAuthenticatorExtensionOutputs() { | |
| 341 |
1
1. getAuthenticatorExtensionOutputs : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getAuthenticatorExtensionOutputs → KILLED |
return AuthenticatorRegistrationExtensionOutputs.fromAuthenticatorData( |
| 342 | credential.getResponse().getParsedAuthenticatorData()); | |
| 343 | } | |
| 344 | ||
| 345 | /** | |
| 346 | * Try to determine whether the created credential is a <a | |
| 347 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#discoverable-credential">discoverable | |
| 348 | * credential</a>, also called a <i>passkey</i>, using the output from the <a | |
| 349 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-authenticator-credential-properties-extension"> | |
| 350 | * <code>credProps</code></a> extension. | |
| 351 | * | |
| 352 | * @return A present <code>true</code> if the created credential is a passkey (discoverable). A | |
| 353 | * present <code> | |
| 354 | * false</code> if the created credential is not a passkey. An empty value if it is not known | |
| 355 | * whether the created credential is a passkey. | |
| 356 | * @see <a | |
| 357 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dom-credentialpropertiesoutput-rk">§10.4. | |
| 358 | * Credential Properties Extension (credProps), "rk" output</a> | |
| 359 | * @see <a | |
| 360 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#discoverable-credential">Discoverable | |
| 361 | * Credential</a> | |
| 362 | * @see <a href="https://passkeys.dev/docs/reference/terms/#passkey">Passkey</a> in <a | |
| 363 | * href="https://passkeys.dev">passkeys.dev</a> reference | |
| 364 | */ | |
| 365 | @JsonIgnore | |
| 366 | public Optional<Boolean> isDiscoverable() { | |
| 367 |
1
1. isDiscoverable : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::isDiscoverable → KILLED |
return getClientExtensionOutputs() |
| 368 |
1
1. lambda$isDiscoverable$3 : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::lambda$isDiscoverable$3 → KILLED |
.flatMap(outputs -> outputs.getCredProps()) |
| 369 |
1
1. lambda$isDiscoverable$4 : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::lambda$isDiscoverable$4 → KILLED |
.flatMap(credProps -> credProps.getRk()); |
| 370 | } | |
| 371 | ||
| 372 | /** | |
| 373 | * Retrieve the <code>credProtect</code> extension policy that was set for the credential, if | |
| 374 | * available. | |
| 375 | * | |
| 376 | * <p>If accessing this, you most likely also want to set the {@link | |
| 377 | * RegistrationExtensionInputs.RegistrationExtensionInputsBuilder#credProtect(Extensions.CredentialProtection.CredentialProtectionInput) | |
| 378 | * credProtect} extension input in the {@link | |
| 379 | * StartRegistrationOptions.StartRegistrationOptionsBuilder#extensions(RegistrationExtensionInputs) | |
| 380 | * extensions} parameter of {@link StartRegistrationOptions}. | |
| 381 | * | |
| 382 | * <p>This output is signed by the authenticator, and thus its trustworthiness may be evaluated | |
| 383 | * using <a | |
| 384 | * href="https://developers.yubico.com/java-webauthn-server/#using_attestation">authenticator | |
| 385 | * attestation</a>. | |
| 386 | * | |
| 387 | * @return the <code>credProtect</code> extension policy that was set for the credential, if | |
| 388 | * available. | |
| 389 | * @since 2.7.0 | |
| 390 | * @see | |
| 391 | * StartRegistrationOptions.StartRegistrationOptionsBuilder#extensions(RegistrationExtensionInputs) | |
| 392 | * @see | |
| 393 | * RegistrationExtensionInputs.RegistrationExtensionInputsBuilder#credProtect(Extensions.CredentialProtection.CredentialProtectionInput) | |
| 394 | * @see <a | |
| 395 | * href="https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-credProtect-extension">CTAP2 | |
| 396 | * §12.1. Credential Protection (credProtect)</a> | |
| 397 | * @see <a href="https://developers.yubico.com/java-webauthn-server/#using_attestation">Using | |
| 398 | * attestation</a> | |
| 399 | */ | |
| 400 | @JsonIgnore | |
| 401 | public Optional<Extensions.CredentialProtection.CredentialProtectionPolicy> | |
| 402 | getCredProtectPolicy() { | |
| 403 |
1
1. getCredProtectPolicy : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getCredProtectPolicy → KILLED |
return getAuthenticatorExtensionOutputs() |
| 404 | .flatMap(AuthenticatorRegistrationExtensionOutputs::getCredProtect); | |
| 405 | } | |
| 406 | ||
| 407 | /** | |
| 408 | * The <a | |
| 409 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#attestation-trust-path">attestation | |
| 410 | * trust path</a> for the created credential, if any. | |
| 411 | * | |
| 412 | * <p>If present, this may be useful for looking up attestation metadata from external sources. | |
| 413 | * The attestation trust path has been successfully verified as trusted if and only if {@link | |
| 414 | * #isAttestationTrusted()} is <code>true</code>. | |
| 415 | * | |
| 416 | * <p>You can ignore this if authenticator attestation is not relevant to your application. | |
| 417 | * | |
| 418 | * @see <a | |
| 419 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#attestation-trust-path">Attestation | |
| 420 | * trust path</a> | |
| 421 | */ | |
| 422 | @JsonIgnore | |
| 423 | public Optional<List<X509Certificate>> getAttestationTrustPath() { | |
| 424 |
1
1. getAttestationTrustPath : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getAttestationTrustPath → KILLED |
return Optional.ofNullable(attestationTrustPath); |
| 425 | } | |
| 426 | ||
| 427 | @JsonProperty("attestationTrustPath") | |
| 428 | private Optional<List<String>> getAttestationTrustPathJson() { | |
| 429 |
1
1. getAttestationTrustPathJson : replaced return value with Optional.empty for com/yubico/webauthn/RegistrationResult::getAttestationTrustPathJson → KILLED |
return getAttestationTrustPath() |
| 430 | .map( | |
| 431 | x5c -> | |
| 432 | x5c.stream() | |
| 433 | .map( | |
| 434 | cert -> { | |
| 435 | try { | |
| 436 |
1
1. lambda$getAttestationTrustPathJson$5 : replaced return value with "" for com/yubico/webauthn/RegistrationResult::lambda$getAttestationTrustPathJson$5 → KILLED |
return new ByteArray(cert.getEncoded()).getBase64(); |
| 437 | } catch (CertificateEncodingException e) { | |
| 438 | throw new RuntimeException(e); | |
| 439 | } | |
| 440 | }) | |
| 441 |
1
1. lambda$getAttestationTrustPathJson$6 : replaced return value with Collections.emptyList for com/yubico/webauthn/RegistrationResult::lambda$getAttestationTrustPathJson$6 → KILLED |
.collect(Collectors.toList())); |
| 442 | } | |
| 443 | } | |
Mutations | ||
| 103 |
1.1 |
|
| 113 |
1.1 |
|
| 117 |
1.1 |
|
| 118 |
1.1 |
|
| 119 |
1.1 |
|
| 129 |
1.1 |
|
| 134 |
1.1 |
|
| 153 |
1.1 2.2 |
|
| 179 |
1.1 2.2 |
|
| 204 |
1.1 2.2 |
|
| 218 |
1.1 |
|
| 231 |
1.1 |
|
| 249 |
1.1 |
|
| 266 |
1.1 |
|
| 285 |
1.1 |
|
| 304 |
1.1 |
|
| 322 |
1.1 |
|
| 323 |
1.1 2.2 |
|
| 341 |
1.1 |
|
| 367 |
1.1 |
|
| 368 |
1.1 |
|
| 369 |
1.1 |
|
| 403 |
1.1 |
|
| 424 |
1.1 |
|
| 429 |
1.1 |
|
| 436 |
1.1 |
|
| 441 |
1.1 |