PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.2.0-rc0/hive/external/shims/src/common/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java

#
Java | 78 lines | 35 code | 8 blank | 35 comment | 0 complexity | 72335f86fc3ee73ebaf76de32e1d73fd MD5 | raw file
 1/**
 2 * Licensed to the Apache Software Foundation (ASF) under one
 3 * or more contributor license agreements.  See the NOTICE file
 4 * distributed with this work for additional information
 5 * regarding copyright ownership.  The ASF licenses this file
 6 * to you under the Apache License, Version 2.0 (the
 7 * "License"); you may not use this file except in compliance
 8 * with the License.  You may obtain a copy of the License at
 9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.hadoop.hive.thrift;
20
21 import java.io.IOException;
22import java.net.InetAddress;
23
24import org.apache.hadoop.conf.Configuration;
25import org.apache.thrift.TProcessor;
26import org.apache.thrift.transport.TTransport;
27import org.apache.thrift.transport.TTransportException;
28import org.apache.thrift.transport.TTransportFactory;
29 /**
30  * This class is only overridden by the secure hadoop shim. It allows
31  * the Thrift SASL support to bridge to Hadoop's UserGroupInformation
32  * & DelegationToken infrastructure.
33  */
34 public class HadoopThriftAuthBridge {
35   public Client createClient() {
36     throw new UnsupportedOperationException(
37       "The current version of Hadoop does not support Authentication");
38   }
39
40   public Server createServer(String keytabFile, String principalConf)
41     throws TTransportException {
42     throw new UnsupportedOperationException(
43       "The current version of Hadoop does not support Authentication");
44   }
45
46
47   public static abstract class Client {
48   /**
49    *
50    * @param principalConfig In the case of Kerberos authentication this will
51    * be the kerberos principal name, for DIGEST-MD5 (delegation token) based
52    * authentication this will be null
53    * @param host The metastore server host name
54    * @param methodStr "KERBEROS" or "DIGEST"
55    * @param tokenStrForm This is url encoded string form of
56    * org.apache.hadoop.security.token.
57    * @param underlyingTransport the underlying transport
58    * @return the transport
59    * @throws IOException
60    */
61     public abstract TTransport createClientTransport(
62       String principalConfig, String host,
63       String methodStr,String tokenStrForm, TTransport underlyingTransport)
64       throws IOException;
65   }
66
67   public static abstract class Server {
68     public abstract TTransportFactory createTransportFactory() throws TTransportException;
69     public abstract TProcessor wrapProcessor(TProcessor processor);
70     public abstract InetAddress getRemoteAddress();
71     public abstract void startDelegationTokenSecretManager(Configuration conf) throws IOException;
72     public abstract String getDelegationToken(String owner, String renewer) 
73     throws IOException, InterruptedException;
74     public abstract long renewDelegationToken(String tokenStrForm) throws IOException;
75     public abstract void cancelDelegationToken(String tokenStrForm) throws IOException;
76   }
77 }
78