blob: 821d41cfabef20e96686d31deded92eed5bde030 (
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
|
package com.yahoo.security.tls;
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); }
}
|