drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sohami <...@git.apache.org>
Subject [GitHub] drill pull request #1040: DRILL-5425: Support HTTP Kerberos auth using SPNEG...
Date Thu, 21 Dec 2017 22:10:15 GMT
Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1040#discussion_r158348706
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/auth/DrillErrorHandler.java
---
    @@ -0,0 +1,45 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.server.rest.auth;
    +
    +import org.apache.drill.exec.server.rest.WebServerConstants;
    +import org.eclipse.jetty.server.handler.ErrorHandler;
    +
    +import javax.servlet.http.HttpServletRequest;
    +import java.io.IOException;
    +import java.io.Writer;
    +
    +/**
    + * Custom ErrorHandler class for Drill's WebServer to have better error message in case
when SPNEGO login failed and
    + * what to do next. In all other cases this would use the generic error page.
    + */
    +public class DrillErrorHandler extends ErrorHandler {
    +
    +  @Override
    +  protected void writeErrorPageMessage(HttpServletRequest request, Writer writer,
    +                                       int code, String message, String uri) throws IOException
{
    +
    +    super.writeErrorPageMessage(request, writer, code, message, uri);
    +
    +    if (uri.equals(WebServerConstants.SPENGO_LOGIN_RESOURCE_PATH)) {
    --- End diff --
    
    There is a reason for doing it like this for handling a special case which is when server
send 401 error code (standard HTTP error page) along with Negotiate header to client and expect
client to respond back with SPNEGO token. In case when client is not configured for SPNEGO
it will not respond and server will not get chance to reply back with an error page. In this
scenario we wanted to provide a message to client on what to do next and hence the special
handling.


---

Mime
View raw message