Hi,
We installed drill-1.6 in distributed mode.
We are trying to config a custom authenticator ,we do the steps as the document
shows,but it failed.
1,Build the following Java file into a JAR file:
package myorg.dept.drill.security;
import java.io.IOException;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.exec.exception.DrillbitStartupException;
import org.apache.drill.exec.rpc.user.security.UserAuthenticationException;
import org.apache.drill.exec.rpc.user.security.UserAuthenticator;
import org.apache.drill.exec.rpc.user.security.UserAuthenticatorTemplate;
/*
* Implement {@link org.apache.drill.exec.rpc.user.security.UserAuthenticator}
for illustrating how to develop a custom authenticator and use it in Drill
*/
@UserAuthenticatorTemplate(type = "myCustomAuthenticatorType")
public class MyCustomDrillUserAuthenticatorImpl implements UserAuthenticator {
public static final String USER_1 = "user1";
public static final String USER_2 = "user2";
public static final String PWD_1 = "pwd1";
public static final String PWD_2 = "pwd2";
/**
* Setup for authenticating user credentials.
*/
@Override
public void setup(DrillConfig drillConfig) throws DrillbitStartupException {
// If the authenticator has any setup such as making sure authenticator
// provider servers are up and running or
// needed libraries are available, it should be added here.
}
/**
* Authenticate the given <i>user</i> and <i>password</i> combination.
*
* @param userName
* @param password
* @throws UserAuthenticationException
* if authentication fails for given user and password.
*/
@Override
public void authenticate(String userName, String password)
throws UserAuthenticationException {
System.out.println("==========enter==========");
if (!(USER_1.equals(userName) && PWD_1.equals(password))
&& !(USER_2.equals(userName) && PWD_2.equals(password))) {
throw new UserAuthenticationException(
"custom failure message if the admin wants to show it to user");
}
}
/**
* Close the authenticator. Used to release resources. Ex. LDAP
* authenticator opens connections to LDAP server, such connections
* resources are released in a safe manner as part of close.
*
* @throws IOException
*/
@Override
public void close() throws IOException {
// Any clean up such as releasing files/network resources should be done
// here
}
}
2,Add the jar file to the path: <drill-install-path>/jars
3,Create a file named drill-module.conf with the following configuration
code,and add it to :<drill-install-path>/jars
drill {
classpath.scanning {
packages += "myorg.dept.drill.security"
}
}
4,modify the drill-override.conf,add the following configuration code in
drill.exec block:
security.user.auth {
enabled: true,
packages += "myorg.dept.drill.security",
impl: "myCustomAuthenticatorType"
}
5,restart the drill again.
Then we find that we can't start the drill successfully.Here is the log:
2016-03-29 16:49:32,392 [main] ERROR o.a.d.e.r.u.s.UserAuthenticatorFactory -
Failed to find the implementation of 'org.apache.drill.exe
c.rpc.user.security.UserAuthenticator' for type 'myCustomAuthenticatorType'
Can you give me some advice?
Thank you very much.
Best Wishes
Xueping Yang
[email protected]