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
  1. Their unique token kind.
  2. An empty constructor.
  3. An entry in the resource file /META-INF/services/org.apache.hadoop.security.token.TokenIdentifier
The base implementation contains
  1. The URI of the FS.
  2. Encryption secrets for use in the destination FS.
Subclasses are required to add whatever information is needed to authenticate the user with the credential provider which their binding class will provide. Important: Add no references to any AWS SDK class, to ensure it can be safely deserialized whenever the relevant token identifier of a token type declared in this JAR is examined.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
    The maximum string length supported for text fields.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind)
    For subclasses to use in their own empty-constructors.
    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.
    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.
    protected
    AbstractS3ATokenIdentifier(org.apache.hadoop.io.Text kind, org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> token)
    Build from a token.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Create the default origin text message with local hostname and timestamp.
    boolean
    Equality check is on superclass and UUID only.
     
    long
     
    Get the encryption secrets.
    long
    Return the expiry time in seconds since 1970-01-01.
     
     
    Get the UUID of this token identifier.
    int
     
    void
    Read state.
    void
    setOrigin(String origin)
     
     
    void
    Validate the token by looking at its fields.
    void
    Write state.

    Methods inherited from class org.apache.hadoop.security.token.delegation.web.DelegationTokenIdentifier

    getKind

    Methods 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, toStringStable

    Methods inherited from class org.apache.hadoop.security.token.TokenIdentifier

    getBytes, getTrackingId

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • MAX_TEXT_LENGTH

      protected static final int MAX_TEXT_LENGTH
      The 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 owner
      renewer - token renewer
      realUser - token real user
      uri - 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

      public String getBucket()
    • getUri

      public URI getUri()
    • getOrigin

      public String getOrigin()
    • setOrigin

      public void setOrigin(String origin)
    • getCreated

      public long getCreated()
    • write

      public void write(DataOutput out) throws IOException
      Write state. Writable.write(DataOutput).
      Specified by:
      write in interface org.apache.hadoop.io.Writable
      Overrides:
      write in class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
      Parameters:
      out - destination
      Throws:
      IOException - failure
    • readFields

      public void readFields(DataInput in) throws DelegationTokenIOException, IOException
      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 org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
      Parameters:
      in - input stream
      Throws:
      DelegationTokenIOException - if the token binding is wrong.
      IOException - IO problems.
    • validate

      public void validate() throws IOException
      Validate the token by looking at its fields.
      Throws:
      IOException - on failure.
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier
    • equals

      public boolean equals(Object o)
      Equality check is on superclass and UUID only.
      Overrides:
      equals in class org.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:
      hashCode in class org.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

      public String getUuid()
      Get the UUID of this token identifier.
      Returns:
      a UUID.
    • getEncryptionSecrets

      public EncryptionSecrets getEncryptionSecrets()
      Get the encryption secrets.
      Returns:
      the encryption secrets within this identifier.
    • createDefaultOriginMessage

      public static String createDefaultOriginMessage()
      Create the default origin text message with local hostname and timestamp.
      Returns:
      a string for token diagnostics.