HADOOP-10776 Open up already widely-used APIs for delegation-token fetching & renewal to ecosystem projects. Contributed by Vinod Kumar Vavilapalli
Cherry picked from 24715cefe8
This commit is contained in:
parent
3df3fa396c
commit
01665e456d
|
@ -383,7 +383,8 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
* if the filesystem does not implement tokens
|
* if the filesystem does not implement tokens
|
||||||
* @see SecurityUtil#buildDTServiceName(URI, int)
|
* @see SecurityUtil#buildDTServiceName(URI, int)
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({ "HDFS", "MapReduce" })
|
@InterfaceAudience.Public
|
||||||
|
@InterfaceStability.Evolving
|
||||||
public String getCanonicalServiceName() {
|
public String getCanonicalServiceName() {
|
||||||
return (getChildFileSystems() == null)
|
return (getChildFileSystems() == null)
|
||||||
? SecurityUtil.buildDTServiceName(getUri(), getDefaultPort())
|
? SecurityUtil.buildDTServiceName(getUri(), getDefaultPort())
|
||||||
|
@ -617,7 +618,8 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
* @return list of new delegation tokens
|
* @return list of new delegation tokens
|
||||||
* @throws IOException problems obtaining a token
|
* @throws IOException problems obtaining a token
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({ "HDFS", "MapReduce" })
|
@InterfaceAudience.Public
|
||||||
|
@InterfaceStability.Evolving
|
||||||
public Token<?>[] addDelegationTokens(
|
public Token<?>[] addDelegationTokens(
|
||||||
final String renewer, Credentials credentials) throws IOException {
|
final String renewer, Credentials credentials) throws IOException {
|
||||||
if (credentials == null) {
|
if (credentials == null) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.hadoop.classification.InterfaceStability;
|
||||||
/**
|
/**
|
||||||
* An exception class for access control related issues.
|
* An exception class for access control related issues.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class AccessControlException extends IOException {
|
public class AccessControlException extends IOException {
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ import org.apache.hadoop.security.proto.SecurityProtos.CredentialsProto;
|
||||||
* A class that provides the facilities of reading and writing
|
* A class that provides the facilities of reading and writing
|
||||||
* secret keys and Tokens.
|
* secret keys and Tokens.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class Credentials implements Writable {
|
public class Credentials implements Writable {
|
||||||
private static final Log LOG = LogFactory.getLog(Credentials.class);
|
private static final Log LOG = LogFactory.getLog(Credentials.class);
|
||||||
|
|
|
@ -58,14 +58,20 @@ import sun.net.util.IPAddressUtil;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
/**
|
||||||
|
* Security Utils.
|
||||||
|
*/
|
||||||
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class SecurityUtil {
|
public final class SecurityUtil {
|
||||||
public static final Log LOG = LogFactory.getLog(SecurityUtil.class);
|
public static final Log LOG = LogFactory.getLog(SecurityUtil.class);
|
||||||
public static final String HOSTNAME_PATTERN = "_HOST";
|
public static final String HOSTNAME_PATTERN = "_HOST";
|
||||||
public static final String FAILED_TO_GET_UGI_MSG_HEADER =
|
public static final String FAILED_TO_GET_UGI_MSG_HEADER =
|
||||||
"Failed to obtain user group information:";
|
"Failed to obtain user group information:";
|
||||||
|
|
||||||
|
private SecurityUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
// controls whether buildTokenService will use an ip or host/ip as given
|
// controls whether buildTokenService will use an ip or host/ip as given
|
||||||
// by the user
|
// by the user
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|
|
@ -87,7 +87,7 @@ import org.slf4j.LoggerFactory;
|
||||||
* user's username and groups. It supports both the Windows, Unix and Kerberos
|
* user's username and groups. It supports both the Windows, Unix and Kerberos
|
||||||
* login modules.
|
* login modules.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "HBase", "Hive", "Oozie"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class UserGroupInformation {
|
public class UserGroupInformation {
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -840,7 +840,7 @@ public class UserGroupInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log in a user using the given subject
|
* 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.
|
* create a new subject.
|
||||||
* @throws IOException if login fails
|
* @throws IOException if login fails
|
||||||
*/
|
*/
|
||||||
|
@ -1694,7 +1694,7 @@ public class UserGroupInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* expensive alternative when checking for a contained element.
|
||||||
* @return the list of users with the primary group first. If the command
|
* @return the list of users with the primary group first. If the command
|
||||||
* fails, it returns an empty list.
|
* fails, it returns an empty list.
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.hadoop.security.AccessControlException;
|
||||||
*
|
*
|
||||||
* This class <em>does not</em> provide the stack trace for security purposes.
|
* This class <em>does not</em> provide the stack trace for security purposes.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "YARN"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class AuthorizationException extends AccessControlException {
|
public class AuthorizationException extends AccessControlException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -504,7 +504,7 @@ public class Token<T extends TokenIdentifier> implements Writable {
|
||||||
* A trivial renewer for token kinds that aren't managed. Sub-classes need
|
* A trivial renewer for token kinds that aren't managed. Sub-classes need
|
||||||
* to implement getKind for their token kind.
|
* to implement getKind for their token kind.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public static class TrivialRenewer extends TokenRenewer {
|
public static class TrivialRenewer extends TokenRenewer {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.hadoop.security.token.TokenIdentifier;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public abstract class AbstractDelegationTokenIdentifier
|
public abstract class AbstractDelegationTokenIdentifier
|
||||||
extends TokenIdentifier {
|
extends TokenIdentifier {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.hadoop.util.Time;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "Hive"})
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public abstract
|
public abstract
|
||||||
class AbstractDelegationTokenSecretManager<TokenIdent
|
class AbstractDelegationTokenSecretManager<TokenIdent
|
||||||
|
|
Loading…
Reference in New Issue