blob: 877ba4e74bde2ff7ad32f5a519c17b8de10fa4a2 (
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
|
package com.yahoo.security.tls.authz;
import com.yahoo.security.tls.policy.CapabilitySet;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Set;
/**
* @author bjorncs
*/
public record ConnectionAuthContext(List<X509Certificate> peerCertificateChain,
CapabilitySet capabilities,
Set<String> matchedPolicies) {
public ConnectionAuthContext {
if (peerCertificateChain.isEmpty()) throw new IllegalArgumentException("Peer certificate chain is empty");
peerCertificateChain = List.copyOf(peerCertificateChain);
matchedPolicies = Set.copyOf(matchedPolicies);
}
public boolean authorized() { return !capabilities.hasNone(); }
public X509Certificate peerCertificate() { return peerCertificateChain.get(0); }
}
|