Github user vanzin commented on a diff in the pull request: https://github.com/apache/incubator-livy/pull/117#discussion_r237316485 --- Diff: thriftserver/server/src/main/scala/org/apache/livy/thriftserver/auth/AuthBridgeServer.scala --- @@ -0,0 +1,301 @@ +/* + * 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.livy.thriftserver.auth + +import java.io.IOException +import java.net.InetAddress +import java.security.{PrivilegedAction, PrivilegedExceptionAction} +import java.util +import javax.security.auth.callback.{Callback, CallbackHandler, NameCallback, PasswordCallback, UnsupportedCallbackException} +import javax.security.sasl.{AuthorizeCallback, RealmCallback, SaslServer} + +import org.apache.commons.codec.binary.Base64 +import org.apache.hadoop.fs.FileSystem +import org.apache.hadoop.security.{SaslRpcServer, UserGroupInformation} +import org.apache.hadoop.security.SaslRpcServer.AuthMethod +import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod +import org.apache.hadoop.security.token.SecretManager.InvalidToken +import org.apache.thrift.{TException, TProcessor} +import org.apache.thrift.protocol.TProtocol +import org.apache.thrift.transport.{TSaslServerTransport, TSocket, TTransport, TTransportException, TTransportFactory} + +import org.apache.livy.Logging + +/** + * The class is taken from Hive's `HadoopThriftAuthBridge.Server`. It bridges Thrift's SASL + * transports to Hadoop's SASL callback handlers and authentication classes. + * + * This class is based on Hive's one. --- End diff -- Redundant comment.
---