Writable@Public @Evolving public class Token<T extends TokenIdentifier> extends java.lang.Object implements Writable
| Modifier and Type | Class | Description |
|---|---|---|
static class |
Token.TrivialRenewer |
A trivial renewer for token kinds that aren't managed.
|
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
Token() |
Default constructor.
|
Token(byte[] identifier,
byte[] password,
Text kind,
Text service) |
Construct a token from the components.
|
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 | Description |
|---|---|---|
java.lang.String |
buildCacheKey() |
|
void |
cancel(Configuration conf) |
Cancel this delegation token.
|
Token<T> |
copyToken() |
|
void |
decodeFromUrlString(java.lang.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).
|
java.lang.String |
encodeToUrlString() |
Encode this token as a url safe string.
|
boolean |
equals(java.lang.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(java.io.DataInput in) |
Deserialize the fields of this object from
in. |
long |
renew(Configuration conf) |
Renew this delegation token.
|
void |
setID(byte[] bytes) |
|
void |
setKind(Text newKind) |
Set the token kind.
|
void |
setPassword(byte[] newPassword) |
|
void |
setService(Text newService) |
Set the service on which the token is supposed to be used.
|
java.lang.String |
toString() |
|
void |
write(java.io.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 void setID(byte[] bytes)
public void setPassword(byte[] newPassword)
public byte[] getIdentifier()
public T decodeIdentifier() throws java.io.IOException
java.io.IOException - failure to unmarshall the datajava.lang.RuntimeException - if the token class could not be instantiated.public byte[] getPassword()
public Text getKind()
@Private public void setKind(Text newKind)
newKind - newKind.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(java.io.DataInput in)
throws java.io.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.java.io.IOException - any other problem for readFields.public void write(java.io.DataOutput out)
throws java.io.IOException
Writableout.public java.lang.String encodeToUrlString()
throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public void decodeFromUrlString(java.lang.String newValue)
throws java.io.IOException
newValue - the encoded stringjava.io.IOException - raised on errors performing I/O.public boolean equals(java.lang.Object right)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String buildCacheKey()
public boolean isManaged()
throws java.io.IOException
java.io.IOException - raised on errors performing I/O.public long renew(Configuration conf) throws java.io.IOException, java.lang.InterruptedException
conf - configuration.java.io.IOException - raised on errors performing I/O.java.lang.InterruptedException - if the thread is interrupted.public void cancel(Configuration conf) throws java.io.IOException, java.lang.InterruptedException
conf - configuration.java.io.IOException - raised on errors performing I/O.java.lang.InterruptedException - if the thread is interrupted.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.