Package org.ldaptive

Class Credential

java.lang.Object
org.ldaptive.Credential

public final class Credential extends Object
Provides convenience methods for converting the various types of passwords into a byte array.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final byte[]
    Credential stored as a byte array.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Credential(byte[] password)
    Creates a new credential.
    Credential(char[] password)
    Creates a new credential.
    Credential(String password)
    Creates a new credential.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Credential
    copy(Credential credential)
    Returns a credential initialized with the supplied credential.
    byte[]
    Returns this credential as a byte array.
    Returns this credential as a string.
    boolean
    Returns whether the underlying byte array is empty.
    boolean
    Returns whether the underlying byte array is null.
     

    Methods inherited from class java.lang.Object

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

    • bytes

      private final byte[] bytes
      Credential stored as a byte array.
  • Constructor Details

    • Credential

      public Credential(String password)
      Creates a new credential.
      Parameters:
      password - converted from UTF-8 to a byte array
    • Credential

      public Credential(char[] password)
      Creates a new credential.
      Parameters:
      password - converted from UTF-8 to a byte array
    • Credential

      public Credential(byte[] password)
      Creates a new credential.
      Parameters:
      password - to store
  • Method Details

    • getBytes

      public byte[] getBytes()
      Returns this credential as a byte array.
      Returns:
      credential bytes
    • getString

      public String getString()
      Returns this credential as a string.
      Returns:
      credential string
    • isNull

      public boolean isNull()
      Returns whether the underlying byte array is null.
      Returns:
      whether the underlying byte array is null
    • isEmpty

      public boolean isEmpty()
      Returns whether the underlying byte array is empty.
      Returns:
      whether the underlying byte array is empty
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy

      public static Credential copy(Credential credential)
      Returns a credential initialized with the supplied credential.
      Parameters:
      credential - to read properties from
      Returns:
      credential