Class SessionTokenIdentifier
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
org.apache.hadoop.fs.s3a.auth.delegation.SessionTokenIdentifier
- All Implemented Interfaces:
org.apache.hadoop.io.Writable
- Direct Known Subclasses:
FullCredentialsTokenIdentifier,RoleTokenIdentifier
A token identifier which contains a set of AWS session credentials,
credentials which will be valid until they expire.
Note 1:
There's a risk here that the reference to
MarshalledCredentials
may trigger a transitive load of AWS classes, a load which will
fail if the aws SDK isn't on the classpath.
Note 2:
This class does support subclassing, but every subclass MUST declare itself
to be of a different token kind.
Otherwise the process for decoding tokens breaks.-
Field Summary
Fields inherited from class org.apache.hadoop.fs.s3a.auth.delegation.AbstractS3ATokenIdentifier
MAX_TEXT_LENGTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor for service loader use.protectedSessionTokenIdentifier(org.apache.hadoop.io.Text kind) Constructor for subclasses.SessionTokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, URI uri, MarshalledCredentials marshalledCredentials, EncryptionSecrets encryptionSecrets, String origin) Constructor.SessionTokenIdentifier(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. -
Method Summary
Modifier and TypeMethodDescriptionlongReturn the expiry time in seconds since 1970-01-01.Get the marshalled credentials.voidreadFields(DataInput in) Read state.toString()Add the (sanitized) marshalled credentials to the string value.voidwrite(DataOutput out) Write state.Methods inherited from class org.apache.hadoop.fs.s3a.auth.delegation.AbstractS3ATokenIdentifier
createDefaultOriginMessage, equals, getBucket, getCreated, getEncryptionSecrets, getOrigin, getUri, getUuid, hashCode, setOrigin, validateMethods 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
-
Constructor Details
-
SessionTokenIdentifier
public SessionTokenIdentifier()Constructor for service loader use. Created with the kindDelegationConstants.SESSION_TOKEN_KIND. Subclasses MUST NOT subclass this; they must provide their own token kind. -
SessionTokenIdentifier
protected SessionTokenIdentifier(org.apache.hadoop.io.Text kind) Constructor for subclasses.- Parameters:
kind- kind of token identifier, for storage in the token kind to implementation map.
-
SessionTokenIdentifier
public SessionTokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.io.Text owner, org.apache.hadoop.io.Text renewer, URI uri, MarshalledCredentials marshalledCredentials, EncryptionSecrets encryptionSecrets, String origin) Constructor.- Parameters:
kind- token kind.owner- token owner.renewer- token renewer.uri- filesystem URI.marshalledCredentials- credentials to marshallencryptionSecrets- encryption secretsorigin- origin text for diagnostics.
-
SessionTokenIdentifier
public SessionTokenIdentifier(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- real user running over proxy useruri- filesystem URI.
-
-
Method Details
-
write
Description copied from class:AbstractS3ATokenIdentifierWrite state.Writable.write(DataOutput).- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Overrides:
writein classAbstractS3ATokenIdentifier- Parameters:
out- destination- Throws:
IOException- failure
-
readFields
Description copied from class:AbstractS3ATokenIdentifierRead 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 classAbstractS3ATokenIdentifier- Parameters:
in- input stream- Throws:
DelegationTokenIOException- if the token binding is wrong.IOException- IO problems.
-
getExpiryTime
public long getExpiryTime()Return the expiry time in seconds since 1970-01-01.- Overrides:
getExpiryTimein classAbstractS3ATokenIdentifier- Returns:
- the time when the AWS credentials expire.
-
getMarshalledCredentials
Get the marshalled credentials.- Returns:
- marshalled AWS credentials.
-
toString
Add the (sanitized) marshalled credentials to the string value.- Overrides:
toStringin classAbstractS3ATokenIdentifier- Returns:
- a string value for test assertions and debugging.
-