-
Notifications
You must be signed in to change notification settings - Fork 949
Expand file tree
/
Copy pathBasicHeader.java
More file actions
71 lines (59 loc) · 1.71 KB
/
BasicHeader.java
File metadata and controls
71 lines (59 loc) · 1.71 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.auth0.jwt.impl;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.Header;
import tools.jackson.databind.DeserializationContext;
import tools.jackson.databind.JsonNode;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import static com.auth0.jwt.impl.JsonNodeClaim.extractClaim;
/**
* The BasicHeader class implements the Header interface.
*/
class BasicHeader implements Header, Serializable {
private static final long serialVersionUID = -4659137688548605095L;
private final String algorithm;
private final String type;
private final String contentType;
private final String keyId;
private final Map<String, JsonNode> tree;
private final DeserializationContext context;
BasicHeader(
String algorithm,
String type,
String contentType,
String keyId,
Map<String, JsonNode> tree,
DeserializationContext context
) {
this.algorithm = algorithm;
this.type = type;
this.contentType = contentType;
this.keyId = keyId;
this.tree = tree == null ? Collections.emptyMap() : Collections.unmodifiableMap(tree);
this.context = context;
}
Map<String, JsonNode> getTree() {
return tree;
}
@Override
public String getAlgorithm() {
return algorithm;
}
@Override
public String getType() {
return type;
}
@Override
public String getContentType() {
return contentType;
}
@Override
public String getKeyId() {
return keyId;
}
@Override
public Claim getHeaderClaim(String name) {
return extractClaim(name, tree, context);
}
}