Class Credentials

  • All Implemented Interfaces:
    IXMLConfigurable, Serializable

    public class Credentials
    extends Object
    implements IXMLConfigurable, Serializable

    User credentials with an optionally encrypted password. To be encrypted, there needs to be an encryption key. Without one, the password is assumed not to be encrypted.

    Password encryption:

    Passwords can be encrypted using EncryptionUtil (or command-line "encrypt.bat" or "encrypt.sh" if those are available to you). In order for the password to be decrypted properly, you need to specify the encryption key used to encrypt it. The key can obtained from a few supported locations. The combination of the password key "value" and "source" is used to properly locate the key. The supported sources are:

    key The actual encryption key.
    file Path to a file containing the encryption key.
    environment Name of an environment variable containing the key.
    property Name of a JVM system property containing the key.

    XML configuration usage:

    
    <username>(the username)</username>
    <password>(the optionally encrypted password)</password>
    <passwordKey>
      <value>(The actual password encryption key or a reference to it.)</value>
      <source>[key|file|environment|property]</source>
      <size>(Size in bits of encryption key. Default is 128.)</size>
    </passwordKey>

    The expected parent tag name is defined by the consuming classes.

    XML usage example:

    
    <sampleConfig>
      <username>goldorak</username>
      <password>3ncryp73d</password>
      <passwordKey>
        <value>/path/to/my.key</value>
        <source>file</source>
      </passwordKey>
    </sampleConfig>

    The above example has the password encrypted with a key. The encryption key is stored in a file (required to decrypt the password).

    Since:
    2.0.0
    Author:
    Pascal Essiembre
    See Also:
    EncryptionKey, EncryptionUtil, Serialized Form
    • Constructor Detail

      • Credentials

        public Credentials()
      • Credentials

        public Credentials​(Credentials copy)