|
||||
0001 /** 0002 * Licensed to the Apache Software Foundation (ASF) under one 0003 * or more contributor license agreements. See the NOTICE file 0004 * distributed with this work for additional information 0005 * regarding copyright ownership. The ASF licenses this file 0006 * to you under the Apache License, Version 2.0 (the 0007 * "License"); you may not use this file except in compliance 0008 * with the License. You may obtain a copy of the License at 0009 * 0010 * http://www.apache.org/licenses/LICENSE-2.0 0011 * 0012 * Unless required by applicable law or agreed to in writing, software 0013 * distributed under the License is distributed on an "AS IS" BASIS, 0014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0015 * See the License for the specific language governing permissions and 0016 * limitations under the License. 0017 */ 0018 package org.apache.hive.service.auth; 0019 0020 import javax.security.sasl.AuthenticationException; 0021 0022 import org.apache.hadoop.hive.conf.HiveConf; 0023 import org.apache.hadoop.util.ReflectionUtils; 0024 0025 /** 0026 * This authentication provider implements the {@code CUSTOM} authentication. It allows a {@link 0027 * PasswdAuthenticationProvider} to be specified at configuration time which may additionally 0028 * implement {@link org.apache.hadoop.conf.Configurable Configurable} to grab Hive's {@link 0029 * org.apache.hadoop.conf.Configuration Configuration}. 0030 */ 0031 public class CustomAuthenticationProviderImpl implements PasswdAuthenticationProvider { 0032 0033 private final PasswdAuthenticationProvider customProvider; 0034 0035 @SuppressWarnings("unchecked") 0036 CustomAuthenticationProviderImpl() { 0037 HiveConf conf = new HiveConf(); 0038 Class<? extends PasswdAuthenticationProvider> customHandlerClass = 0039 (Class<? extends PasswdAuthenticationProvider>) conf.getClass( 0040 HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, 0041 PasswdAuthenticationProvider.class); 0042 customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); 0043 } 0044 0045 @Override 0046 public void Authenticate(String user, String password) throws AuthenticationException { 0047 customProvider.Authenticate(user, password); 0048 } 0049 0050 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |