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

public class SessionTokenIdentifier extends AbstractS3ATokenIdentifier
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.
  • Constructor Details

    • SessionTokenIdentifier

      public SessionTokenIdentifier()
      Constructor for service loader use. Created with the kind DelegationConstants.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 marshall
      encryptionSecrets - encryption secrets
      origin - 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 owner
      renewer - token renewer
      realUser - real user running over proxy user
      uri - filesystem URI.
  • Method Details

    • write

      public void write(DataOutput out) throws IOException
      Description copied from class: AbstractS3ATokenIdentifier
      Write state. Writable.write(DataOutput).
      Specified by:
      write in interface org.apache.hadoop.io.Writable
      Overrides:
      write in class AbstractS3ATokenIdentifier
      Parameters:
      out - destination
      Throws:
      IOException - failure
    • readFields

      public void readFields(DataInput in) throws IOException
      Description copied from class: AbstractS3ATokenIdentifier
      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:
      readFields in interface org.apache.hadoop.io.Writable
      Overrides:
      readFields in class AbstractS3ATokenIdentifier
      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:
      getExpiryTime in class AbstractS3ATokenIdentifier
      Returns:
      the time when the AWS credentials expire.
    • getMarshalledCredentials

      public MarshalledCredentials getMarshalledCredentials()
      Get the marshalled credentials.
      Returns:
      marshalled AWS credentials.
    • toString

      public String toString()
      Add the (sanitized) marshalled credentials to the string value.
      Overrides:
      toString in class AbstractS3ATokenIdentifier
      Returns:
      a string value for test assertions and debugging.