HADOOP-10776 Open up already widely-used APIs for delegation-token fetching & renewal to ecosystem projects. Contributed by Vinod Kumar Vavilapalli

Cherry picked from 24715cefe80fba531dd16a44ec1cead67c389eb1
This commit is contained in:
Steve Loughran 2016-11-24 17:51:49 +00:00
parent 3df3fa396c
commit 01665e456d
9 changed files with 21 additions and 13 deletions

View File

@ -383,7 +383,8 @@ protected static FileSystem getFSofPath(final Path absOrFqPath,
* if the filesystem does not implement tokens
* @see SecurityUtil#buildDTServiceName(URI, int)
*/
@InterfaceAudience.LimitedPrivate({ "HDFS", "MapReduce" })
@InterfaceAudience.Public
@InterfaceStability.Evolving
public String getCanonicalServiceName() {
return (getChildFileSystems() == null)
? SecurityUtil.buildDTServiceName(getUri(), getDefaultPort())
@ -617,7 +618,8 @@ public Token<?> getDelegationToken(String renewer) throws IOException {
* @return list of new delegation tokens
* @throws IOException problems obtaining a token
*/
@InterfaceAudience.LimitedPrivate({ "HDFS", "MapReduce" })
@InterfaceAudience.Public
@InterfaceStability.Evolving
public Token<?>[] addDelegationTokens(
final String renewer, Credentials credentials) throws IOException {
if (credentials == null) {

View File

@ -24,7 +24,7 @@
/**
* An exception class for access control related issues.
*/
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class AccessControlException extends IOException {

View File

@ -57,7 +57,7 @@
* A class that provides the facilities of reading and writing
* secret keys and Tokens.
*/
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class Credentials implements Writable {
private static final Log LOG = LogFactory.getLog(Credentials.class);

View File

@ -58,14 +58,20 @@
import com.google.common.annotations.VisibleForTesting;
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
/**
* Security Utils.
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class SecurityUtil {
public final class SecurityUtil {
public static final Log LOG = LogFactory.getLog(SecurityUtil.class);
public static final String HOSTNAME_PATTERN = "_HOST";
public static final String FAILED_TO_GET_UGI_MSG_HEADER =
"Failed to obtain user group information:";
private SecurityUtil() {
}
// controls whether buildTokenService will use an ip or host/ip as given
// by the user
@VisibleForTesting

View File

@ -87,7 +87,7 @@
* user's username and groups. It supports both the Windows, Unix and Kerberos
* login modules.
*/
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "HBase", "Hive", "Oozie"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class UserGroupInformation {
@VisibleForTesting
@ -840,7 +840,7 @@ public static String trimLoginMethod(String userName) {
/**
* Log in a user using the given subject
* @parma subject the subject to use when logging in a user, or null to
* @param subject the subject to use when logging in a user, or null to
* create a new subject.
* @throws IOException if login fails
*/
@ -1694,7 +1694,7 @@ private synchronized Credentials getCredentialsInternal() {
}
/**
* Get the group names for this user. {@ #getGroups(String)} is less
* Get the group names for this user. {@link #getGroups()} is less
* expensive alternative when checking for a contained element.
* @return the list of users with the primary group first. If the command
* fails, it returns an empty list.

View File

@ -29,7 +29,7 @@
*
* This class <em>does not</em> provide the stack trace for security purposes.
*/
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "YARN"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class AuthorizationException extends AccessControlException {
private static final long serialVersionUID = 1L;

View File

@ -504,7 +504,7 @@ public void cancel(Configuration conf
* A trivial renewer for token kinds that aren't managed. Sub-classes need
* to implement getKind for their token kind.
*/
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public static class TrivialRenewer extends TokenRenewer {

View File

@ -34,7 +34,7 @@
import com.google.common.annotations.VisibleForTesting;
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class AbstractDelegationTokenIdentifier
extends TokenIdentifier {

View File

@ -44,7 +44,7 @@
import com.google.common.base.Preconditions;
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "Hive"})
@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract
class AbstractDelegationTokenSecretManager<TokenIdent