blob: 0bb99aea8866838c1314a49b92b882d5adbcd2cd (
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
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls.authz;
import com.yahoo.security.SslContextBuilder;
import com.yahoo.security.tls.policy.AuthorizedPeers;
import javax.net.ssl.TrustManager;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
/**
* @author bjorncs
*/
public class PeerAuthorizerTrustManagersFactory implements SslContextBuilder.TrustManagersFactory {
private final AuthorizedPeers authorizedPeers;
private PeerAuthorizerTrustManager.Mode mode;
public PeerAuthorizerTrustManagersFactory(AuthorizedPeers authorizedPeers, PeerAuthorizerTrustManager.Mode mode) {
this.authorizedPeers = authorizedPeers;
this.mode = mode;
}
@Override
public TrustManager[] createTrustManagers(KeyStore truststore) throws GeneralSecurityException {
return PeerAuthorizerTrustManager.wrapTrustManagersFromKeystore(authorizedPeers, mode, truststore);
}
}
|