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 java.net.MalformedURLException;
8
import java.net.URL;
9
import java.security.cert.X509Certificate;
10
import java.time.LocalDate;
11
import java.util.Optional;
12
import lombok.AccessLevel;
13
import lombok.AllArgsConstructor;
14
import lombok.Builder;
15
import lombok.Getter;
16
import lombok.NonNull;
17
import lombok.Value;
18
import lombok.extern.jackson.Jacksonized;
19
20
/**
21
 * Contains an {@link AuthenticatorStatus} and additional data associated with it, if any.
22
 *
23
 * @see <a
24
 *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
25
 *     Metadata Service §3.1.3. StatusReport dictionary</a>
26
 */
27
@Value
28
@Builder
29
@Jacksonized
30
@AllArgsConstructor(access = AccessLevel.PRIVATE)
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
   * @see <a
95
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
96
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
97
   */
98
  String certificationRequirementsVersion;
99
100
  /**
101
   * @see <a
102
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
103
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
104
   */
105
  public Optional<LocalDate> getEffectiveDate() {
106 1 1. getEffectiveDate : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getEffectiveDate → SURVIVED
    return Optional.ofNullable(effectiveDate);
107
  }
108
109
  /**
110
   * @see <a
111
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
112
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
113
   */
114
  public Optional<Long> getAuthenticatorVersion() {
115 1 1. getAuthenticatorVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getAuthenticatorVersion → KILLED
    return Optional.ofNullable(authenticatorVersion);
116
  }
117
118
  /**
119
   * @see <a
120
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
121
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
122
   */
123
  @JsonIgnore
124
  public Optional<X509Certificate> getCertificate() {
125 1 1. getCertificate : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificate → SURVIVED
    return Optional.ofNullable(this.certificate);
126
  }
127
128
  /**
129
   * Attempt to parse the {@link #getUrlAsString() url} property, if any, as a {@link URL}.
130
   *
131
   * @return A present value if and only if {@link #getUrlAsString()} is present and a valid URL.
132
   */
133
  public Optional<URL> getUrl() {
134
    try {
135 1 1. getUrl : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrl → NO_COVERAGE
      return Optional.of(new URL(url));
136
    } catch (MalformedURLException e) {
137
      return Optional.empty();
138
    }
139
  }
140
141
  /**
142
   * Get the raw <code>url</code> property of this {@link StatusReport} object. This may or may not
143
   * be a valid URL.
144
   *
145
   * @see <a
146
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
147
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
148
   */
149
  @JsonIgnore
150
  public Optional<String> getUrlAsString() {
151 1 1. getUrlAsString : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getUrlAsString → NO_COVERAGE
    return Optional.ofNullable(this.url);
152
  }
153
154
  /**
155
   * @see <a
156
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
157
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
158
   */
159
  public Optional<String> getCertificationDescriptor() {
160 1 1. getCertificationDescriptor : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationDescriptor → SURVIVED
    return Optional.ofNullable(this.certificationDescriptor);
161
  }
162
163
  /**
164
   * @see <a
165
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
166
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
167
   */
168
  public Optional<String> getCertificateNumber() {
169 1 1. getCertificateNumber : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificateNumber → SURVIVED
    return Optional.ofNullable(this.certificateNumber);
170
  }
171
172
  /**
173
   * @see <a
174
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
175
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
176
   */
177
  public Optional<String> getCertificationPolicyVersion() {
178 1 1. getCertificationPolicyVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationPolicyVersion → SURVIVED
    return Optional.ofNullable(this.certificationPolicyVersion);
179
  }
180
181
  /**
182
   * @see <a
183
   *     href="https://fidoalliance.org/specs/mds/fido-metadata-service-v3.0-ps-20210518.html#statusreport-dictionary">FIDO
184
   *     Metadata Service §3.1.3. StatusReport dictionary</a>
185
   */
186
  public Optional<String> getCertificationRequirementsVersion() {
187 1 1. getCertificationRequirementsVersion : replaced return value with Optional.empty for com/yubico/fido/metadata/StatusReport::getCertificationRequirementsVersion → SURVIVED
    return Optional.ofNullable(this.certificationRequirementsVersion);
188
  }
189
}

Mutations

106

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

115

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

125

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

135

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

151

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

160

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

169

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

178

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

187

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

Active mutators

Tests examined


Report generated by PIT 1.15.0