AttestationConveyancePreference.java

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.data;
26
27
import com.fasterxml.jackson.annotation.JsonCreator;
28
import com.fasterxml.jackson.annotation.JsonValue;
29
import java.util.Optional;
30
import java.util.stream.Stream;
31
import lombok.AccessLevel;
32
import lombok.AllArgsConstructor;
33
import lombok.Getter;
34
import lombok.NonNull;
35
36
/**
37
 * Relying Parties may use this to specify their preference regarding attestation conveyance during
38
 * credential generation.
39
 *
40
 * @see <a href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#attestation-conveyance">§5.4.6.
41
 *     Attestation Conveyance Preference Enumeration (enum AttestationConveyancePreference) </a>
42
 */
43
@AllArgsConstructor(access = AccessLevel.PRIVATE)
44
public enum AttestationConveyancePreference {
45
46
  /**
47
   * Indicates that the Relying Party is not interested in authenticator attestation.
48
   *
49
   * <p>For example, in order to potentially avoid having to obtain user consent to relay
50
   * identifying information to the Relying Party, or to save a roundtrip to an <a
51
   * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#attestation-ca">Attestation CA</a>.
52
   *
53
   * <p>This is the default value.
54
   */
55
  NONE("none"),
56
57
  /**
58
   * Indicates that the Relying Party prefers an attestation conveyance yielding verifiable
59
   * attestation statements, but allows the client to decide how to obtain such attestation
60
   * statements. The client MAY replace the authenticator-generated attestation statements with
61
   * attestation statements generated by an <a
62
   * href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#anonymization-ca">Anonymization
63
   * CA</a>, in order to protect the user’s privacy, or to assist Relying Parties with attestation
64
   * verification in a heterogeneous ecosystem.
65
   *
66
   * <p>Note: There is no guarantee that the Relying Party will obtain a verifiable attestation
67
   * statement in this case. For example, in the case that the authenticator employs self
68
   * attestation.
69
   */
70
  INDIRECT("indirect"),
71
72
  /**
73
   * Indicates that the Relying Party wants to receive the attestation statement as generated by the
74
   * authenticator.
75
   */
76
  DIRECT("direct"),
77
78
  /**
79
   * This value indicates that the Relying Party wants to receive an attestation statement that may
80
   * include uniquely identifying information. This is intended for controlled deployments within an
81
   * enterprise where the organization wishes to tie registrations to specific authenticators. User
82
   * agents MUST NOT provide such an attestation unless the user agent or authenticator
83
   * configuration permits it for the requested RP ID.
84
   *
85
   * <p>If permitted, the user agent SHOULD signal to the authenticator (at invocation time) that
86
   * enterprise attestation is requested, and convey the resulting AAGUID and attestation statement,
87
   * unaltered, to the Relying Party.
88
   */
89
  ENTERPRISE("enterprise");
90
91
  @JsonValue @Getter @NonNull private final String value;
92
93 1 1. fromString : negated conditional → KILLED
  private static Optional<AttestationConveyancePreference> fromString(@NonNull String value) {
94 3 1. lambda$fromString$0 : replaced boolean return with false for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromString$0 → KILLED
2. lambda$fromString$0 : replaced boolean return with true for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromString$0 → KILLED
3. fromString : replaced return value with Optional.empty for com/yubico/webauthn/data/AttestationConveyancePreference::fromString → KILLED
    return Stream.of(values()).filter(v -> v.value.equals(value)).findAny();
95
  }
96
97
  @JsonCreator
98 1 1. fromJsonString : negated conditional → KILLED
  private static AttestationConveyancePreference fromJsonString(@NonNull String value) {
99 1 1. fromJsonString : replaced return value with null for com/yubico/webauthn/data/AttestationConveyancePreference::fromJsonString → KILLED
    return fromString(value)
100
        .orElseThrow(
101
            () ->
102 1 1. lambda$fromJsonString$1 : replaced return value with null for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromJsonString$1 → KILLED
                new IllegalArgumentException(
103
                    String.format(
104
                        "Unknown %s value: %s",
105
                        AttestationConveyancePreference.class.getSimpleName(), value)));
106
  }
107
}

Mutations

93

1.1
Location : fromString
Killed by : com.yubico.webauthn.data.EnumsSpec
negated conditional → KILLED

94

1.1
Location : lambda$fromString$0
Killed by : com.yubico.webauthn.data.EnumsSpec
replaced boolean return with false for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromString$0 → KILLED

2.2
Location : lambda$fromString$0
Killed by : com.yubico.webauthn.data.EnumsSpec
replaced boolean return with true for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromString$0 → KILLED

3.3
Location : fromString
Killed by : com.yubico.webauthn.data.EnumsSpec
replaced return value with Optional.empty for com/yubico/webauthn/data/AttestationConveyancePreference::fromString → KILLED

98

1.1
Location : fromJsonString
Killed by : com.yubico.webauthn.data.EnumsSpec
negated conditional → KILLED

99

1.1
Location : fromJsonString
Killed by : com.yubico.webauthn.data.EnumsSpec
replaced return value with null for com/yubico/webauthn/data/AttestationConveyancePreference::fromJsonString → KILLED

102

1.1
Location : lambda$fromJsonString$1
Killed by : com.yubico.webauthn.data.EnumsSpec
replaced return value with null for com/yubico/webauthn/data/AttestationConveyancePreference::lambda$fromJsonString$1 → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.0