@InterfaceAudience.Public @InterfaceStability.Evolving public class Token<T extends TokenIdentifier> extends Object implements Writable
| Modifier and Type | Class and Description |
|---|---|
static class |
Token.TrivialRenewer
A trivial renewer for token kinds that aren't managed.
|
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
Token()
Default constructor.
|
Token(byte[] identifier,
byte[] password,
Text kind,
Text service)
Construct a token from the components.
|
Token(org.apache.hadoop.security.proto.SecurityProtos.TokenProto tokenPB)
Construct a Token from a TokenProto.
|
Token(Token<T> other)
Clone a token.
|
Token(T id,
SecretManager<T> mgr)
Construct a token given a token identifier and a secret manager for the
type of the token identifier.
|
| Modifier and Type | Method and Description |
|---|---|
String |
buildCacheKey() |
void |
cancel(Configuration conf)
Cancel this delegation token.
|
Token<T> |
copyToken() |
void |
decodeFromUrlString(String newValue)
Decode the given url safe string into this token.
|
T |
decodeIdentifier()
Get the token identifier object, or null if it could not be constructed
(because the class could not be loaded, for example).
|
String |
encodeToUrlString()
Encode this token as a url safe string.
|
boolean |
equals(Object right) |
byte[] |
getIdentifier()
Get the token identifier's byte representation.
|
Text |
getKind()
Get the token kind.
|
byte[] |
getPassword()
Get the token password/secret.
|
Text |
getService()
Get the service on which the token is supposed to be used.
|
int |
hashCode() |
boolean |
isManaged()
Is this token managed so that it can be renewed or cancelled?
|
boolean |
isPrivate()
Whether this is a private token.
|
boolean |
isPrivateCloneOf(Text thePublicService)
Whether this is a private clone of a public token.
|
Token<T> |
privateClone(Text newService)
Create a private clone of a public token.
|
void |
readFields(DataInput in)
Deserialize the fields of this object from
in. |
long |
renew(Configuration conf)
Renew this delegation token.
|
void |
setID(byte[] bytes) |
void |
setPassword(byte[] newPassword) |
void |
setService(Text newService)
Set the service on which the token is supposed to be used.
|
String |
toString() |
org.apache.hadoop.security.proto.SecurityProtos.TokenProto |
toTokenProto()
Construct a TokenProto from this Token instance.
|
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
public Token(T id, SecretManager<T> mgr)
id - the token identifiermgr - the secret managerpublic Token(byte[] identifier,
byte[] password,
Text kind,
Text service)
identifier - the token identifierpassword - the token's passwordkind - the kind of tokenservice - the service for this tokenpublic Token()
public Token(org.apache.hadoop.security.proto.SecurityProtos.TokenProto tokenPB)
tokenPB - the TokenProto objectpublic void setID(byte[] bytes)
public void setPassword(byte[] newPassword)
public org.apache.hadoop.security.proto.SecurityProtos.TokenProto toTokenProto()
public byte[] getIdentifier()
public T decodeIdentifier() throws IOException
IOException - failure to unmarshall the dataRuntimeException - if the token class could not be instantiated.public byte[] getPassword()
public Text getKind()
public Text getService()
public void setService(Text newService)
newService - the service namepublic boolean isPrivate()
public boolean isPrivateCloneOf(Text thePublicService)
thePublicService - the public service namepublic Token<T> privateClone(Text newService)
newService - the new service namepublic void readFields(DataInput in) throws IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields in interface Writablein - DataInput to deseriablize this object from.IOExceptionpublic void write(DataOutput out) throws IOException
Writableout.write in interface Writableout - DataOuput to serialize this object into.IOExceptionpublic String encodeToUrlString() throws IOException
IOExceptionpublic void decodeFromUrlString(String newValue) throws IOException
newValue - the encoded stringIOExceptionpublic String buildCacheKey()
public boolean isManaged()
throws IOException
IOExceptionpublic long renew(Configuration conf) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void cancel(Configuration conf) throws IOException, InterruptedException
IOExceptionInterruptedExceptionCopyright © 2022 Apache Software Foundation. All rights reserved.