1 | package com.yubico.fido.metadata; | |
2 | ||
3 | import java.util.Optional; | |
4 | import lombok.AccessLevel; | |
5 | import lombok.AllArgsConstructor; | |
6 | import lombok.Getter; | |
7 | import lombok.NonNull; | |
8 | ||
9 | /** | |
10 | * A FIDO Metadata Service metadata BLOB was successfully downloaded and validated, but contained an | |
11 | * unexpected legal header. | |
12 | * | |
13 | * <p>This exception contains the offending downloaded metadata BLOB as well as the cached metadata | |
14 | * BLOB, if any (see {@link #getCachedBlob()}). This enables applications to gracefully fall back to | |
15 | * the cached blob when possible, while notifying maintainers that action is required for the new | |
16 | * legal header. | |
17 | */ | |
18 | @AllArgsConstructor(access = AccessLevel.PACKAGE) | |
19 | public class UnexpectedLegalHeader extends Exception { | |
20 | ||
21 | /** The cached metadata BLOB, if any, which is assumed to have an expected legal header. */ | |
22 | private final MetadataBLOB cachedBlob; | |
23 | ||
24 | /** | |
25 | * The newly downloaded metadata BLOB, which has an unexpected legal header. | |
26 | * | |
27 | * <p>The unexpected legal header can be retrieved via the {@link MetadataBLOB#getPayload() | |
28 | * getPayload()}.{@link MetadataBLOBPayload#getLegalHeader() getLegalHeader()} methods. | |
29 | * | |
30 | * @see MetadataBLOB#getPayload() | |
31 | * @see MetadataBLOBPayload#getLegalHeader() | |
32 | */ | |
33 | @Getter @NonNull private final MetadataBLOB downloadedBlob; | |
34 | ||
35 | /** The cached metadata BLOB, if any. */ | |
36 | public Optional<MetadataBLOB> getCachedBlob() { | |
37 |
1
1. getCachedBlob : replaced return value with Optional.empty for com/yubico/fido/metadata/UnexpectedLegalHeader::getCachedBlob → NO_COVERAGE |
return Optional.ofNullable(cachedBlob); |
38 | } | |
39 | } | |
Mutations | ||
37 |
1.1 |