001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 package org.apache.hadoop.security; 019 020 import java.io.IOException; 021 import java.util.List; 022 023 import org.apache.hadoop.classification.InterfaceAudience; 024 import org.apache.hadoop.classification.InterfaceStability; 025 import org.apache.hadoop.fs.CommonConfigurationKeysPublic; 026 027 /** 028 * An interface for the implementation of <userId, userName> mapping 029 * and <groupId, groupName> mapping 030 */ 031 @InterfaceAudience.Public 032 @InterfaceStability.Evolving 033 public interface IdMappingServiceProvider { 034 035 // Return uid for given user name 036 public int getUid(String user) throws IOException; 037 038 // Return gid for given group name 039 public int getGid(String group) throws IOException; 040 041 // Return user name for given user id uid, if not found, return 042 // <unknown> passed to this method 043 public String getUserName(int uid, String unknown); 044 045 // Return group name for given groupd id gid, if not found, return 046 // <unknown> passed to this method 047 public String getGroupName(int gid, String unknown); 048 049 // Return uid for given user name. 050 // When can't map user, return user name's string hashcode 051 public int getUidAllowingUnknown(String user); 052 053 // Return gid for given group name. 054 // When can't map group, return group name's string hashcode 055 public int getGidAllowingUnknown(String group); 056 }