summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/main/java/com/yahoo/config/provision/DataplaneToken.java
blob: 422c8bf3a08194421e00a12fd9ef9cb6acd2259f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;

import java.util.List;
import java.util.Objects;

/**
 * Id, fingerprints and check access hashes of a data plane token
 *
 * @author mortent
 */
public class DataplaneToken {

    private final String tokenId;
    private final List<TokenValue> tokenValues;


    public DataplaneToken(String tokenId, List<TokenValue> tokenValues) {
        this.tokenId = tokenId;
        this.tokenValues = List.copyOf(tokenValues);
    }

    public String tokenId() {
        return tokenId;
    }

    public List<TokenValue> tokenValues() {
        return tokenValues;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DataplaneToken that = (DataplaneToken) o;
        return Objects.equals(tokenId, that.tokenId) && Objects.equals(tokenValues, that.tokenValues);
    }

    @Override
    public int hashCode() {
        return Objects.hash(tokenId, tokenValues);
    }

    @Override
    public String toString() {
        return "DataplaneToken{" +
               "tokenId='" + tokenId + '\'' +
               ", tokenValues=" + tokenValues +
               '}';
    }

    public record TokenValue (String fingerprint, String checkAccessHash){
    }
}