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.yubico.webauthn.data.AuthenticatorAttestationResponse; | |
28 | import com.yubico.webauthn.data.ByteArray; | |
29 | import com.yubico.webauthn.data.ClientRegistrationExtensionOutputs; | |
30 | import com.yubico.webauthn.data.PublicKeyCredential; | |
31 | import com.yubico.webauthn.data.PublicKeyCredentialCreationOptions; | |
32 | import java.util.Optional; | |
33 | import lombok.Builder; | |
34 | import lombok.NonNull; | |
35 | import lombok.Value; | |
36 | ||
37 | /** Parameters for {@link RelyingParty#finishRegistration(FinishRegistrationOptions)}. */ | |
38 | @Value | |
39 | @Builder(toBuilder = true) | |
40 | public class FinishRegistrationOptions { | |
41 | ||
42 | /** The request that the {@link #getResponse() response} is a response to. */ | |
43 | @NonNull private final PublicKeyCredentialCreationOptions request; | |
44 | ||
45 | /** | |
46 | * The client's response to the {@link #getRequest() request}. | |
47 | * | |
48 | * <p><a | |
49 | * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-createCredential">navigator.credentials.create()</a> | |
50 | */ | |
51 | @NonNull | |
52 | private final PublicKeyCredential< | |
53 | AuthenticatorAttestationResponse, ClientRegistrationExtensionOutputs> | |
54 | response; | |
55 | ||
56 | /** | |
57 | * The <a href="https://tools.ietf.org/html/rfc8471#section-3.2">token binding ID</a> of the | |
58 | * connection to the client, if any. | |
59 | * | |
60 | * @see <a href="https://tools.ietf.org/html/rfc8471">The Token Binding Protocol Version 1.0</a> | |
61 | */ | |
62 | private final ByteArray callerTokenBindingId; | |
63 | ||
64 | /** | |
65 | * The <a href="https://tools.ietf.org/html/rfc8471#section-3.2">token binding ID</a> of the | |
66 | * connection to the client, if any. | |
67 | * | |
68 | * @see <a href="https://tools.ietf.org/html/rfc8471">The Token Binding Protocol Version 1.0</a> | |
69 | */ | |
70 | public Optional<ByteArray> getCallerTokenBindingId() { | |
71 |
1
1. getCallerTokenBindingId : replaced return value with Optional.empty for com/yubico/webauthn/FinishRegistrationOptions::getCallerTokenBindingId → KILLED |
return Optional.ofNullable(callerTokenBindingId); |
72 | } | |
73 | ||
74 | public static FinishRegistrationOptionsBuilder.MandatoryStages builder() { | |
75 |
1
1. builder : replaced return value with null for com/yubico/webauthn/FinishRegistrationOptions::builder → KILLED |
return new FinishRegistrationOptionsBuilder.MandatoryStages(); |
76 | } | |
77 | ||
78 | public static class FinishRegistrationOptionsBuilder { | |
79 | private ByteArray callerTokenBindingId = null; | |
80 | ||
81 | public static class MandatoryStages { | |
82 | private final FinishRegistrationOptionsBuilder builder = | |
83 | new FinishRegistrationOptionsBuilder(); | |
84 | ||
85 | /** | |
86 | * {@link FinishRegistrationOptionsBuilder#request(PublicKeyCredentialCreationOptions) | |
87 | * request} is a required parameter. | |
88 | * | |
89 | * @see FinishRegistrationOptionsBuilder#request(PublicKeyCredentialCreationOptions) | |
90 | */ | |
91 | public Step2 request(PublicKeyCredentialCreationOptions request) { | |
92 | builder.request(request); | |
93 |
1
1. request : replaced return value with null for com/yubico/webauthn/FinishRegistrationOptions$FinishRegistrationOptionsBuilder$MandatoryStages::request → KILLED |
return new Step2(); |
94 | } | |
95 | ||
96 | public class Step2 { | |
97 | /** | |
98 | * {@link FinishRegistrationOptionsBuilder#response(PublicKeyCredential) response} is a | |
99 | * required parameter. | |
100 | * | |
101 | * @see FinishRegistrationOptionsBuilder#response(PublicKeyCredential) | |
102 | */ | |
103 | public FinishRegistrationOptionsBuilder response( | |
104 | PublicKeyCredential< | |
105 | AuthenticatorAttestationResponse, ClientRegistrationExtensionOutputs> | |
106 | response) { | |
107 |
1
1. response : replaced return value with null for com/yubico/webauthn/FinishRegistrationOptions$FinishRegistrationOptionsBuilder$MandatoryStages$Step2::response → KILLED |
return builder.response(response); |
108 | } | |
109 | } | |
110 | } | |
111 | ||
112 | /** | |
113 | * The <a href="https://tools.ietf.org/html/rfc8471#section-3.2">token binding ID</a> of the | |
114 | * connection to the client, if any. | |
115 | * | |
116 | * @see <a href="https://tools.ietf.org/html/rfc8471">The Token Binding Protocol Version 1.0</a> | |
117 | */ | |
118 | public FinishRegistrationOptionsBuilder callerTokenBindingId( | |
119 |
1
1. callerTokenBindingId : negated conditional → KILLED |
@NonNull Optional<ByteArray> callerTokenBindingId) { |
120 | this.callerTokenBindingId = callerTokenBindingId.orElse(null); | |
121 |
1
1. callerTokenBindingId : replaced return value with null for com/yubico/webauthn/FinishRegistrationOptions$FinishRegistrationOptionsBuilder::callerTokenBindingId → KILLED |
return this; |
122 | } | |
123 | ||
124 | /** | |
125 | * The <a href="https://tools.ietf.org/html/rfc8471#section-3.2">token binding ID</a> of the | |
126 | * connection to the client, if any. | |
127 | * | |
128 | * @see <a href="https://tools.ietf.org/html/rfc8471">The Token Binding Protocol Version 1.0</a> | |
129 | */ | |
130 | public FinishRegistrationOptionsBuilder callerTokenBindingId( | |
131 |
1
1. callerTokenBindingId : negated conditional → NO_COVERAGE |
@NonNull ByteArray callerTokenBindingId) { |
132 |
1
1. callerTokenBindingId : replaced return value with null for com/yubico/webauthn/FinishRegistrationOptions$FinishRegistrationOptionsBuilder::callerTokenBindingId → NO_COVERAGE |
return this.callerTokenBindingId(Optional.of(callerTokenBindingId)); |
133 | } | |
134 | } | |
135 | } | |
Mutations | ||
71 |
1.1 |
|
75 |
1.1 |
|
93 |
1.1 |
|
107 |
1.1 |
|
119 |
1.1 |
|
121 |
1.1 |
|
131 |
1.1 |
|
132 |
1.1 |