public class HtpasswdFileUserAuthenticator extends Object implements UserAuthenticator
Currently supports MD5, SHA-1, and plaintext passwords.
Use the htpasswd command line tool to create and modify htpasswd files.
By default this loads the passwords from /opt/drill/conf/htpasswd
. Users can change the path by
putting the absolute file path as drill.exec.security.user.auth.htpasswd.path
in
drill-override.conf
.
This is intended for situations where the list of users is relatively static, and you are running drill in a container so using pam is not convenient.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_HTPASSWD_AUTHENTICATOR_PATH |
Constructor and Description |
---|
HtpasswdFileUserAuthenticator() |
Modifier and Type | Method and Description |
---|---|
void |
authenticate(String username,
String password)
Validate the given username and password against the password file
|
void |
close()
Free resources associated with this authenticator
|
static boolean |
isPasswordValid(String password,
String hash)
Check password against hash read from the file
|
protected void |
read()
Read the password file into the map, if the file has changed since we last read it
|
void |
setup(DrillConfig drillConfig)
Setup for authenticating user credentials.
|
public static final String DEFAULT_HTPASSWD_AUTHENTICATOR_PATH
public void setup(DrillConfig drillConfig) throws DrillbitStartupException
UserAuthenticator
setup
in interface UserAuthenticator
DrillbitStartupException
public static boolean isPasswordValid(String password, String hash)
password
- User provided passwordhash
- Hash stored in the htpasswd filepublic void authenticate(String username, String password) throws UserAuthenticationException
authenticate
in interface UserAuthenticator
username
- Username providedpassword
- Password providedUserAuthenticationException
- If the username and password could not be validatedprotected void read()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface UserAuthenticator
Copyright © 1970 The Apache Software Foundation. All rights reserved.