There is one step that is missing from the doc.
For the custom classpath scanner to find the new class put the following
config code in a file named drill-module.conf at the root of the jar file
with custom authentication class.
drill {
classpath.scanning {
packages += "myorg.drill.security"
}
}
Could you please create a JIRA for changing the documentation?
Thanks
Venki
On Tue, Mar 1, 2016 at 2:24 PM, Elango Ganesan <[email protected]> wrote:
> Hi All,
>
>
> I tried creating a custom authenticator with Drill 1.5.0 by creating jar
> based on below source code and drill configuration. I placed the jar in
> $DRILLHOME/jars/
>
>
> drill.exec: {
>
> cluster-id: "drillbits1",
>
> zk.connect: "dmdvhc0002d:2181,dmdvhc0003d:2181,dmdvhc0004d:2181"
>
> security.user.auth: {
>
> enabled: true,
>
> packages += “myorg.drill.security",
>
> impl: “sso"
>
> }
>
> }
>
> package myorg.drill.security;
>
>
>
> import myorg.drill.security.SSOFilter;
>
> import myorg.drill.security.SecurityServiceException;
>
> 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;
>
>
> import java.io.IOException;
>
> import java.net.InetAddress;
>
> import java.net.UnknownHostException;
>
>
>
> @UserAuthenticatorTemplate(type = “sso")
>
> public class DrillMyUserAuthenticator implements UserAuthenticator {
>
> private String ipAddress;
>
>
>
>
> public void setup(DrillConfig drillConfig) throws
> DrillbitStartupException
> {
>
> try {
>
> ipAddress= InetAddress.*getLocalHost*().getHostAddress();
>
> } catch (UnknownHostException e) {
>
> e.printStackTrace();
>
> throw new DrillbitStartupException(e);
>
> }
>
> }
>
>
> public void authenticate(String userName, String password) throws
> UserAuthenticationException
> {
>
>
> try {
>
> SSOFilter.*setSourceAddress*(ipAddress);
>
> SSOFilter.*authenticate*(userName, password);
>
> } catch (SecurityServiceException e) {
>
> e.printStackTrace();
>
> throw new UserAuthenticationException(e.getMessage());
>
> }
>
>
> }
>
>
> public void close() throws IOException {
>
>
> }
>
> }
>
>
> And I am getting below exception
>
>
> exception in thread "main"
> org.apache.drill.exec.exception.DrillbitStartupException: Failure while
> initializing values in Drillbit.
>
> at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:277)
>
> at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:261)
>
> at org.apache.drill.exec.server.Drillbit.main(Drillbit.java:257)
>
> Caused by: org.apache.drill.exec.exception.DrillbitStartupException: Failed
> to find the implementation of
> 'org.apache.drill.exec.rpc.user.security.UserAuthenticator' for type ’sso'
>
> at
>
> org.apache.drill.exec.rpc.user.security.UserAuthenticatorFactory.createAuthenticator(UserAuthenticatorFactory.java:103)
>
> at org.apache.drill.exec.rpc.user.UserServer.<init>(UserServer.java:80)
>
> at
> org.apache.drill.exec.service.ServiceEngine.<init>(ServiceEngine.java:79)
>
> at org.apache.drill.exec.server.Drillbit.<init>(Drillbit.java:89)
>
> at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:275)
>
>
> Please let me know if I am missing something with the config or code. I
> followed below steps in the documentation to create this
>
>
> https://drill.apache.org/docs/configuring-user-authentication/
>
>
> Thanks,
>
> Elango
>