public class WorkerTokenAuthorizer extends Object implements PasswordProvider, Closeable
Allow for SASL authentication using worker tokens.
| Constructor and Description |
|---|
WorkerTokenAuthorizer(Map<String,Object> conf,
ThriftConnectionType connectionType)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static com.codahale.metrics.Meter |
getPasswordFailuresMeter() |
Optional<char[]> |
getPasswordFor(String userName)
Get an optional password for a user.
|
String |
userName(String userName)
Convert the supplied user name to the actual user name that should be used in the system.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisImpersonationAllowedpublic WorkerTokenAuthorizer(Map<String,Object> conf, ThriftConnectionType connectionType)
Constructor.
conf - the daemon config for the server.connectionType - the type of connection we are authorizing.public Optional<char[]> getPasswordFor(String userName)
PasswordProviderGet an optional password for a user. If no password for the user is found the option will be empty and another PasswordProvider would be tried.
getPasswordFor in interface PasswordProvideruserName - the user this is for.public static com.codahale.metrics.Meter getPasswordFailuresMeter()
public String userName(String userName)
PasswordProviderConvert the supplied user name to the actual user name that should be used in the system. This may be called on any name. If it cannot be translated then a null may be returned or an exception thrown. If getPassword returns successfully this should not return null, nor throw an exception for the same user.
userName in interface PasswordProvideruserName - the SASL negotiated user name.public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2021 The Apache Software Foundation. All rights reserved.