Record Class CertificateBinding

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.x509.CertificateBinding
Record Components:
id - identifier of the binding.
userId - identifier of the account (the users row).
fingerprintSha256 - SHA-256 fingerprint of the DER-encoded certificate, as 64 lower case hexadecimal digits.
subjectDn - subject distinguished name of the certificate, kept to tell the bindings apart.
createdAt - instant at which the certificate was bound.

public record CertificateBinding(UUID id, UUID userId, String fingerprintSha256, String subjectDn, Instant createdAt) extends Record
The binding of a client certificate to an account: the certificate is recognised by the SHA-256 fingerprint of its encoded form, never by its subject, which anyone can choose.
  • Field Details

    • id

      private final UUID id
      The field for the id record component.
    • userId

      private final UUID userId
      The field for the userId record component.
    • fingerprintSha256

      private final String fingerprintSha256
      The field for the fingerprintSha256 record component.
    • subjectDn

      private final String subjectDn
      The field for the subjectDn record component.
    • createdAt

      private final Instant createdAt
      The field for the createdAt record component.
    • FINGERPRINT_LENGTH

      public static final int FINGERPRINT_LENGTH
      Number of hexadecimal digits of a SHA-256 fingerprint.
      See Also:
    • FINGERPRINT

      private static final Pattern FINGERPRINT
      Shape of a fingerprint: lower case hexadecimal digits only.
  • Constructor Details

    • CertificateBinding

      public CertificateBinding(UUID id, UUID userId, String fingerprintSha256, String subjectDn, Instant createdAt)
      Validates the binding.
      Throws:
      IllegalArgumentException - if the id, the account or the creation instant is missing, the fingerprint is not 64 lower case hexadecimal digits, or the subject is blank.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public UUID id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • userId

      public UUID userId()
      Returns the value of the userId record component.
      Returns:
      the value of the userId record component
    • fingerprintSha256

      public String fingerprintSha256()
      Returns the value of the fingerprintSha256 record component.
      Returns:
      the value of the fingerprintSha256 record component
    • subjectDn

      public String subjectDn()
      Returns the value of the subjectDn record component.
      Returns:
      the value of the subjectDn record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component