public final class SecurityUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
QUORUM_HOSTNAME_PATTERN |
Constructor and Description |
---|
SecurityUtils() |
Modifier and Type | Method and Description |
---|---|
static SaslClient |
createSaslClient(Subject subject,
String servicePrincipal,
String protocol,
String serverName,
org.slf4j.Logger LOG,
String entity)
Create an instance of a SaslClient.
|
static SaslServer |
createSaslServer(Subject subject,
String protocol,
String serverName,
CallbackHandler callbackHandler,
org.slf4j.Logger LOG)
Create an instance of a SaslServer.
|
static String |
getServerPrincipal(String principalConfig,
String hostname)
Convert Kerberos principal name pattern to valid Kerberos principal name.
|
public static final String QUORUM_HOSTNAME_PATTERN
public static SaslClient createSaslClient(Subject subject, String servicePrincipal, String protocol, String serverName, org.slf4j.Logger LOG, String entity) throws SaslException
subject
- subjectservicePrincipal
- principalprotocol
- name of the protocol for which the authentication is being performedserverName
- name of the server to authenticate toLOG
- loggerentity
- can be either zookeeper client or quorum learnerSaslException
public static SaslServer createSaslServer(Subject subject, String protocol, String serverName, CallbackHandler callbackHandler, org.slf4j.Logger LOG)
subject
- subjectprotocol
- protocolserverName
- server namecallbackHandler
- login callback handlerLOG
- loggerpublic static String getServerPrincipal(String principalConfig, String hostname)
principalConfig
- the Kerberos principal name conf value to converthostname
- the fully-qualified domain name used for substitutionCopyright © 2008–2019 The Apache Software Foundation. All rights reserved.