Apache Drill - 使用CustomAuthenticaor的DrillStartupException

时间:2016-03-01 22:35:16

标签: apache-drill

我尝试使用Drill 1.5.0创建自定义身份验证器,方法是根据以下源代码和钻取配置创建jar。我将jar放在$DRILLHOME/jars/

drill-override.conf文件:

drill.exec: {   
  cluster-id: "drillbits1",  
  zk.connect: "host1:2181,host2:2181,host3:2181"   
 security.user.auth: {   
            enabled: true,  
            packages += “myorg.drill.security",  
            impl: “sso"  
       }   
}

DrillMyUserAuthenticator上课:

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 {
    }  
}

我正处于异常之下:

  线程“main”中的

异常org.apache.drill.exec.exception.DrillbitStartupException:在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)

     

引起:org.apache.drill.exec.exception.DrillbitStartupException:无法找到类型'sso'的'org.apache.drill.exec.rpc.user.security.UserAuthenticator'的实现

     

at org.apache.drill.exec.rpc.user.security.UserAuthenticatorFactory.createAuthenticator(UserAuthenticatorFactory.java:103)

     

at org.apache.drill.exec.rpc.user.UserServer。(UserServer.java:80)

     

at org.apache.drill.exec.service.ServiceEngine。(ServiceEngine.java:79)

     

at org.apache.drill.exec.server.Drillbit。(Drillbit.java:89)

     

at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:275)

如果我遗失了配置或代码,请告诉我。

我跟着Drill's documentation创建了这个。

1 个答案:

答案 0 :(得分:0)

原来是Drill Side的文档问题。 https://issues.apache.org/jira/browse/DRILL-4461

以上Jira有解决问题的方法。应该使用drill-module.conf创建自定义身份验证器的新jar,以便类路径扫描程序将其提取

drill: {
  classpath.scanning: {
    packages: [
    "myorg.drill.security"
    ]
  }
}