summaryrefslogtreecommitdiffstats
path: root/security-utils/src/main/java/com/yahoo/security/tls/authz/PeerAuthorizerTrustManagersFactory.java
blob: 6ec8450c035875270e3bbb3b74e0862bdd6aaf05 (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
// 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.AuthorizationMode;
import com.yahoo.security.tls.policy.AuthorizedPeers;

import java.security.KeyStore;

/**
 * @author bjorncs
 */
public class PeerAuthorizerTrustManagersFactory implements SslContextBuilder.TrustManagerFactory {
    private final AuthorizedPeers authorizedPeers;
    private AuthorizationMode mode;

    public PeerAuthorizerTrustManagersFactory(AuthorizedPeers authorizedPeers, AuthorizationMode mode) {
        this.authorizedPeers = authorizedPeers;
        this.mode = mode;
    }

    @Override
    public PeerAuthorizerTrustManager createTrustManager(KeyStore truststore) {
        return new PeerAuthorizerTrustManager(authorizedPeers, mode, truststore);
    }
}