StatusReport.java

1
package com.yubico.fido.metadata;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import com.fasterxml.jackson.annotation.JsonProperty;
5
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
6
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
7
import com.yubico.internal.util.CollectionUtil;
8
import java.net.MalformedURLException;
9
import java.net.URL;
10
import java.security.cert.X509Certificate;
11
import java.time.LocalDate;
12
import java.util.List;
13
import java.util.Optional;
14
import lombok.AccessLevel;
15
import lombok.Builder;
16
import lombok.Getter;
17
import lombok.NonNull;
18
import lombok.Value;
19
import lombok.extern.jackson.Jacksonized;
20
21
/**
22
 * Contains an {@link AuthenticatorStatus} and additional data associated with it, if any.
23
 *
24
 * @see <a
25
 *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
26
 *     Metadata Service §3.1.3. StatusReport dictionary</a>
27
 */
28
@Value
29
@Builder
30
@Jacksonized
31
public class StatusReport {
32
33
  /**
34
   * @see <a
35
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
36
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
37
   */
38
  @NonNull AuthenticatorStatus status;
39
40
  /**
41
   * @see <a
42
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
43
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
44
   */
45
  LocalDate effectiveDate;
46
47
  /**
48
   * @see <a
49
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
50
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
51
   */
52
  Long authenticatorVersion;
53
54
  /**
55
   * @see <a
56
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
57
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
58
   */
59
  @JsonDeserialize(converter = CertFromBase64Converter.class)
60
  @JsonSerialize(converter = CertToBase64Converter.class)
61
  X509Certificate certificate;
62
63
  /**
64
   * @see <a
65
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
66
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
67
   */
68
  @JsonProperty("url")
69
  @Getter(AccessLevel.NONE)
70
  String url;
71
72
  /**
73
   * @see <a
74
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
75
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
76
   */
77
  String certificationDescriptor;
78
79
  /**
80
   * @see <a
81
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
82
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
83
   */
84
  String certificateNumber;
85
86
  /**
87
   * @see <a
88
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
89
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
90
   */
91
  String certificationPolicyVersion;
92
93
  /**
94
   * @since 2.9.0
95
   * @see <a
96
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
97
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
98
   */
99
  List<String> certificationProfiles;
100
101
  /**
102
   * @see <a
103
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
104
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
105
   */
106
  String certificationRequirementsVersion;
107
108
  /**
109
   * @since 2.9.0
110
   * @see <a
111
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
112
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
113
   */
114
  String sunsetDate;
115
116
  /**
117
   * @since 2.9.0
118
   * @see <a
119
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
120
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
121
   */
122
  Long fipsRevision;
123
124
  /**
125
   * @since 2.9.0
126
   * @see <a
127
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
128
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
129
   */
130
  Long fipsPhysicalSecurityLevel;
131
132
  private StatusReport(
133 1 1. <init> : negated conditional → KILLED
      @NonNull AuthenticatorStatus status,
134
      LocalDate effectiveDate,
135
      Long authenticatorVersion,
136
      X509Certificate certificate,
137
      String url,
138
      String certificationDescriptor,
139
      String certificateNumber,
140
      String certificationPolicyVersion,
141
      List<String> certificationProfiles,
142
      String certificationRequirementsVersion,
143
      String sunsetDate,
144
      Long fipsRevision,
145
      Long fipsPhysicalSecurityLevel) {
146
    this.status = status;
147
    this.effectiveDate = effectiveDate;
148
    this.authenticatorVersion = authenticatorVersion;
149
    this.certificate = certificate;
150
    this.url = url;
151
    this.certificationDescriptor = certificationDescriptor;
152
    this.certificateNumber = certificateNumber;
153
    this.certificationPolicyVersion = certificationPolicyVersion;
154
    this.certificationProfiles = CollectionUtil.immutableListOrEmpty(certificationProfiles);
155
    this.certificationRequirementsVersion = certificationRequirementsVersion;
156
    this.sunsetDate = sunsetDate;
157
    this.fipsRevision = fipsRevision;
158
    this.fipsPhysicalSecurityLevel = fipsPhysicalSecurityLevel;
159
  }
160
161
  /**
162
   * @see <a
163
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
164
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
165
   */
166
  public Optional<LocalDate> getEffectiveDate() {
167 1 1. getEffectiveDate : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getEffectiveDate → SURVIVED
    return Optional.ofNullable(effectiveDate);
168
  }
169
170
  /**
171
   * @see <a
172
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
173
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
174
   */
175
  public Optional<Long> getAuthenticatorVersion() {
176 1 1. getAuthenticatorVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getAuthenticatorVersion → KILLED
    return Optional.ofNullable(authenticatorVersion);
177
  }
178
179
  /**
180
   * @see <a
181
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
182
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
183
   */
184
  @JsonIgnore
185
  public Optional<X509Certificate> getCertificate() {
186 1 1. getCertificate : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificate → SURVIVED
    return Optional.ofNullable(this.certificate);
187
  }
188
189
  /**
190
   * Attempt to parse the {@link #getUrlAsString() url} property, if any, as a {@link URL}.
191
   *
192
   * @return A present value if and only if {@link #getUrlAsString()} is present and a valid URL.
193
   */
194
  public Optional<URL> getUrl() {
195
    try {
196 1 1. getUrl : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrl → NO_COVERAGE
      return Optional.of(new URL(url));
197
    } catch (MalformedURLException e) {
198
      return Optional.empty();
199
    }
200
  }
201
202
  /**
203
   * Get the raw <code>url</code> property of this {@link StatusReport} object. This may or may not
204
   * be a valid URL.
205
   *
206
   * @see <a
207
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
208
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
209
   */
210
  @JsonIgnore
211
  public Optional<String> getUrlAsString() {
212 1 1. getUrlAsString : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrlAsString → NO_COVERAGE
    return Optional.ofNullable(this.url);
213
  }
214
215
  /**
216
   * @see <a
217
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
218
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
219
   */
220
  public Optional<String> getCertificationDescriptor() {
221 1 1. getCertificationDescriptor : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationDescriptor → SURVIVED
    return Optional.ofNullable(this.certificationDescriptor);
222
  }
223
224
  /**
225
   * @see <a
226
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
227
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
228
   */
229
  public Optional<String> getCertificateNumber() {
230 1 1. getCertificateNumber : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificateNumber → SURVIVED
    return Optional.ofNullable(this.certificateNumber);
231
  }
232
233
  /**
234
   * @see <a
235
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
236
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
237
   */
238
  public Optional<String> getCertificationPolicyVersion() {
239 1 1. getCertificationPolicyVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationPolicyVersion → SURVIVED
    return Optional.ofNullable(this.certificationPolicyVersion);
240
  }
241
242
  /**
243
   * @see <a
244
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
245
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
246
   */
247
  public Optional<String> getCertificationRequirementsVersion() {
248 1 1. getCertificationRequirementsVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationRequirementsVersion → SURVIVED
    return Optional.ofNullable(this.certificationRequirementsVersion);
249
  }
250
251
  /**
252
   * @since 2.9.0
253
   * @see <a
254
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
255
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
256
   */
257
  public Optional<String> getSunsetDate() {
258 1 1. getSunsetDate : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getSunsetDate → SURVIVED
    return Optional.ofNullable(this.sunsetDate);
259
  }
260
261
  /**
262
   * @since 2.9.0
263
   * @see <a
264
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
265
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
266
   */
267
  public Optional<Long> getFipsRevision() {
268 1 1. getFipsRevision : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getFipsRevision → SURVIVED
    return Optional.ofNullable(fipsRevision);
269
  }
270
271
  /**
272
   * @since 2.9.0
273
   * @see <a
274
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-stat-rep">FIDO
275
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
276
   */
277
  public Optional<Long> getFipsPhysicalSecurityLevel() {
278 1 1. getFipsPhysicalSecurityLevel : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getFipsPhysicalSecurityLevel → SURVIVED
    return Optional.ofNullable(fipsPhysicalSecurityLevel);
279
  }
280
}

Mutations

133

1.1
Location : <init>
Killed by : com.yubico.fido.metadata.FidoMds3Spec
negated conditional → KILLED

167

1.1
Location : getEffectiveDate
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getEffectiveDate → SURVIVED

176

1.1
Location : getAuthenticatorVersion
Killed by : com.yubico.fido.metadata.FidoMds3Spec
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getAuthenticatorVersion → KILLED

186

1.1
Location : getCertificate
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificate → SURVIVED

196

1.1
Location : getUrl
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrl → NO_COVERAGE

212

1.1
Location : getUrlAsString
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrlAsString → NO_COVERAGE

221

1.1
Location : getCertificationDescriptor
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationDescriptor → SURVIVED

230

1.1
Location : getCertificateNumber
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificateNumber → SURVIVED

239

1.1
Location : getCertificationPolicyVersion
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationPolicyVersion → SURVIVED

248

1.1
Location : getCertificationRequirementsVersion
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationRequirementsVersion → SURVIVED

258

1.1
Location : getSunsetDate
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getSunsetDate → SURVIVED

268

1.1
Location : getFipsRevision
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getFipsRevision → SURVIVED

278

1.1
Location : getFipsPhysicalSecurityLevel
Killed by : none
replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getFipsPhysicalSecurityLevel → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.15.0