PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  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. package org.apache.hadoop.hive.thrift;
  19. import java.io.IOException;
  20. import java.net.InetAddress;
  21. import org.apache.hadoop.conf.Configuration;
  22. import org.apache.thrift.TProcessor;
  23. import org.apache.thrift.transport.TTransport;
  24. import org.apache.thrift.transport.TTransportException;
  25. import org.apache.thrift.transport.TTransportFactory;
  26. /**
  27. * This class is only overridden by the secure hadoop shim. It allows
  28. * the Thrift SASL support to bridge to Hadoop's UserGroupInformation
  29. * & DelegationToken infrastructure.
  30. */
  31. public class HadoopThriftAuthBridge {
  32. public Client createClient() {
  33. throw new UnsupportedOperationException(
  34. "The current version of Hadoop does not support Authentication");
  35. }
  36. public Server createServer(String keytabFile, String principalConf)
  37. throws TTransportException {
  38. throw new UnsupportedOperationException(
  39. "The current version of Hadoop does not support Authentication");
  40. }
  41. public static abstract class Client {
  42. /**
  43. *
  44. * @param principalConfig In the case of Kerberos authentication this will
  45. * be the kerberos principal name, for DIGEST-MD5 (delegation token) based
  46. * authentication this will be null
  47. * @param host The metastore server host name
  48. * @param methodStr "KERBEROS" or "DIGEST"
  49. * @param tokenStrForm This is url encoded string form of
  50. * org.apache.hadoop.security.token.
  51. * @param underlyingTransport the underlying transport
  52. * @return the transport
  53. * @throws IOException
  54. */
  55. public abstract TTransport createClientTransport(
  56. String principalConfig, String host,
  57. String methodStr,String tokenStrForm, TTransport underlyingTransport)
  58. throws IOException;
  59. }
  60. public static abstract class Server {
  61. public abstract TTransportFactory createTransportFactory() throws TTransportException;
  62. public abstract TProcessor wrapProcessor(TProcessor processor);
  63. public abstract InetAddress getRemoteAddress();
  64. public abstract void startDelegationTokenSecretManager(Configuration conf) throws IOException;
  65. public abstract String getDelegationToken(String owner, String renewer)
  66. throws IOException, InterruptedException;
  67. public abstract long renewDelegationToken(String tokenStrForm) throws IOException;
  68. public abstract void cancelDelegationToken(String tokenStrForm) throws IOException;
  69. }
  70. }