/** * Copyright 2016 Yahoo Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.yahoo.pulsar.client.api; import java.io.Serializable; import java.security.PrivateKey; import java.security.cert.Certificate; import java.util.Map; import java.util.Set; /** * Interface for accessing data which are used in variety of authentication schemes on client side */ public interface AuthenticationDataProvider extends Serializable { /* * TLS */ /** * Check if data for TLS are available. * * @return true if this authentication data contain data for TLS */ default boolean hasDataForTls() { return false; } /** * * @return a client certificate chain, or null if the data are not available */ default Certificate[] getTlsCertificates() { return null; } /** * * @return a private key for the client certificate, or null if the data are not available */ default PrivateKey getTlsPrivateKey() { return null; } /* * HTTP */ /** * Check if data for HTTP are available. * * @return true if this authentication data contain data for HTTP */ default boolean hasDataForHttp() { return false; } /** * * @return a authentication scheme, or <code>null<c/ode> if the request will not be authenticated */ default String getHttpAuthType() { return null; } /** * * @return an enumeration of all the header names */ default Set<Map.Entry<String, String>> getHttpHeaders() { return null; } /* * Command */ /** * Check if data from Pulsar protocol are available. * * @return true if this authentication data contain data from Pulsar protocol */ default boolean hasDataFromCommand() { return false; } /** * * @return authentication data which will be stored in a command */ default String getCommandData() { return null; } }