Class AbstractS3ATokenIdentifier
java.lang.Object
org.apache.hadoop.security.token.TokenIdentifier
org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
org.apache.hadoop.security.token.delegation.web.DelegationTokenIdentifier
org.apache.hadoop.fs.s3a.auth.delegation.AbstractS3ATokenIdentifier
- All Implemented Interfaces:
org.apache.hadoop.io.Writable
- Direct Known Subclasses:
SessionTokenIdentifier
public abstract class AbstractS3ATokenIdentifier
extends org.apache.hadoop.security.token.delegation.web.DelegationTokenIdentifier
An S3A Delegation Token Identifier: contains the information needed
to talk to S3A.
These are loaded via the service loader API an used in a map of
Kind to class, which is then looked up to deserialize token
identifiers of a given class.
Every non-abstract class must provide
- Their unique token kind.
- An empty constructor.
- An entry in the resource file
/META-INF/services/org.apache.hadoop.security.token.TokenIdentifier
- The URI of the FS.
- Encryption secrets for use in the destination FS.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe maximum string length supported for text fields. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind) For subclasses to use in their own empty-constructors.protectedAbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, URI uri, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, String origin, EncryptionSecrets encryptionSecrets) Constructor.protectedAbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, org.apache.hadoop.io.Text realUser, URI uri) Constructor.protectedAbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> token) Build from a token. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCreate the default origin text message with local hostname and timestamp.booleanEquality check is on superclass and UUID only.longGet the encryption secrets.longReturn the expiry time in seconds since 1970-01-01.getUri()getUuid()Get the UUID of this token identifier.inthashCode()voidreadFields(DataInput in) Read state.voidtoString()voidvalidate()Validate the token by looking at its fields.voidwrite(DataOutput out) Write state.Methods inherited from class org.apache.hadoop.security.token.delegation.web.DelegationTokenIdentifier
getKindMethods inherited from class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
getIssueDate, getMasterKeyId, getMaxDate, getOwner, getRealUser, getRenewer, getSequenceNumber, getUser, isEqual, setIssueDate, setMasterKeyId, setMaxDate, setOwner, setRealUser, setRenewer, setSequenceNumber, toStringStableMethods inherited from class org.apache.hadoop.security.token.TokenIdentifier
getBytes, getTrackingId
-
Field Details
-
MAX_TEXT_LENGTH
protected static final int MAX_TEXT_LENGTHThe maximum string length supported for text fields.- See Also:
-
-
Constructor Details
-
AbstractS3ATokenIdentifier
protected AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, URI uri, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, String origin, EncryptionSecrets encryptionSecrets) Constructor.- Parameters:
kind- token kind.uri- filesystem URI.owner- token owner.renewer- token renewer.origin- origin text for diagnostics.encryptionSecrets- encryption secrets to set.
-
AbstractS3ATokenIdentifier
protected AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, org.apache.hadoop.io.Text realUser, URI uri) Constructor.- Parameters:
kind- token kind.owner- token ownerrenewer- token renewerrealUser- token real useruri- filesystem URI.
-
AbstractS3ATokenIdentifier
protected AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> token) throws IOException Build from a token. This has been written for refresh operations; if someone implements refresh it will be relevant.- Parameters:
kind- token kind.token- to to build from- Throws:
IOException- failure to build the identifier.
-
AbstractS3ATokenIdentifier
protected AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind) For subclasses to use in their own empty-constructors.- Parameters:
kind- token kind.
-
-
Method Details
-
getBucket
-
getUri
-
getOrigin
-
setOrigin
-
getCreated
public long getCreated() -
write
Write state.Writable.write(DataOutput).- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Overrides:
writein classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier- Parameters:
out- destination- Throws:
IOException- failure
-
readFields
Read state.Writable.readFields(DataInput). Note: this operation gets called in toString() operations on tokens, so must either always succeed, or throw an IOException to trigger the catch and downgrade. RuntimeExceptions (e.g. Preconditions checks) are not to be used here for this reason.)- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Overrides:
readFieldsin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier- Parameters:
in- input stream- Throws:
DelegationTokenIOException- if the token binding is wrong.IOException- IO problems.
-
validate
Validate the token by looking at its fields.- Throws:
IOException- on failure.
-
toString
- Overrides:
toStringin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
-
equals
Equality check is on superclass and UUID only.- Overrides:
equalsin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier- Parameters:
o- other.- Returns:
- true if the base class considers them equal and the URIs match.
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
-
getExpiryTime
public long getExpiryTime()Return the expiry time in seconds since 1970-01-01.- Returns:
- the time when the session credential expire.
-
getUuid
Get the UUID of this token identifier.- Returns:
- a UUID.
-
getEncryptionSecrets
Get the encryption secrets.- Returns:
- the encryption secrets within this identifier.
-
createDefaultOriginMessage
Create the default origin text message with local hostname and timestamp.- Returns:
- a string for token diagnostics.
-