public class KerberosToken extends Object implements AuthenticationToken
AuthenticationToken.AuthenticationTokenSerializer, AuthenticationToken.Properties, AuthenticationToken.TokenProperty
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_NAME |
Constructor and Description |
---|
KerberosToken()
Creates a token using the login user as returned by
UserGroupInformation.getCurrentUser() |
KerberosToken(String principal)
Creates a token using the provided principal and the currently logged-in user via
UserGroupInformation . |
KerberosToken(String principal,
File keytab)
Creates a Kerberos token for the specified principal using the provided keytab.
|
KerberosToken(String principal,
File keytab,
boolean replaceCurrentUser)
Deprecated.
since 1.8.0, @see #KerberosToken(String, File)
|
Modifier and Type | Method and Description |
---|---|
KerberosToken |
clone() |
void |
destroy() |
boolean |
equals(Object obj) |
File |
getKeytab()
The keytab file used to perform Kerberos login.
|
String |
getPrincipal()
The identity of the user to which this token belongs to according to Kerberos
|
Set<AuthenticationToken.TokenProperty> |
getProperties() |
int |
hashCode() |
void |
init(AuthenticationToken.Properties properties) |
boolean |
isDestroyed() |
void |
readFields(DataInput in) |
void |
write(DataOutput out) |
public static final String CLASS_NAME
public KerberosToken(String principal) throws IOException
UserGroupInformation
.principal
- The user that is logged inIOException
public KerberosToken(String principal, File keytab) throws IOException
This constructor does not have any side effects.
principal
- The Kerberos principalkeytab
- A keytab file containing the principal's credentials.IOException
@Deprecated public KerberosToken(String principal, File keytab, boolean replaceCurrentUser) throws IOException
UserGroupInformation
using the provided principal and keytab. A key for the principal must exist in the keytab,
otherwise login will fail.principal
- The Kerberos principalkeytab
- A keytab filereplaceCurrentUser
- Should the current Hadoop user be replaced with this userIOException
public KerberosToken() throws IOException
UserGroupInformation.getCurrentUser()
IOException
- If the current logged in user cannot be computed.public KerberosToken clone()
clone
in interface AuthenticationToken
clone
in class Object
public String getPrincipal()
public File getKeytab()
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void destroy() throws DestroyFailedException
destroy
in interface Destroyable
DestroyFailedException
public boolean isDestroyed()
isDestroyed
in interface Destroyable
public void init(AuthenticationToken.Properties properties)
init
in interface AuthenticationToken
public Set<AuthenticationToken.TokenProperty> getProperties()
getProperties
in interface AuthenticationToken
Copyright © 2011–2017 The Apache Software Foundation. All rights reserved.