Record Class SigningKey

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.keys.SigningKey
Record Components:
kid - key identifier, published in the kid header of signed tokens.
alg - JWS algorithm the key is used with, for example RS256.
publicJwk - the public key as a JSON Web Key.
encryptedPrivateJwk - the private key as a JSON Web Key, encrypted.
status - lifecycle state.
createdAt - instant at which the key was generated.
activatedAt - instant at which the key started signing; null until then.
retiredAt - instant at which the key stopped signing; null until then.

public record SigningKey(String kid, String alg, String publicJwk, String encryptedPrivateJwk, SigningKeyStatus status, Instant createdAt, Instant activatedAt, Instant retiredAt) extends Record
An asymmetric key pair used to sign tokens. The private half is only ever kept encrypted.
  • Field Details

    • kid

      private final String kid
      The field for the kid record component.
    • alg

      private final String alg
      The field for the alg record component.
    • publicJwk

      private final String publicJwk
      The field for the publicJwk record component.
    • encryptedPrivateJwk

      private final String encryptedPrivateJwk
      The field for the encryptedPrivateJwk record component.
    • status

      private final SigningKeyStatus status
      The field for the status record component.
    • createdAt

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

      private final Instant activatedAt
      The field for the activatedAt record component.
    • retiredAt

      private final Instant retiredAt
      The field for the retiredAt record component.
  • Constructor Details

  • Method Details

    • activate

      public SigningKey activate(Instant now)
      Creates the key as it is once it starts signing.
      Parameters:
      now - instant at which it starts signing.
      Returns:
      the active key.
    • retire

      public SigningKey retire(Instant now)
      Creates the key as it is once it stops signing.
      Parameters:
      now - instant at which it stops signing.
      Returns:
      the retired key.
    • 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.
    • kid

      public String kid()
      Returns the value of the kid record component.
      Returns:
      the value of the kid record component
    • alg

      public String alg()
      Returns the value of the alg record component.
      Returns:
      the value of the alg record component
    • publicJwk

      public String publicJwk()
      Returns the value of the publicJwk record component.
      Returns:
      the value of the publicJwk record component
    • encryptedPrivateJwk

      public String encryptedPrivateJwk()
      Returns the value of the encryptedPrivateJwk record component.
      Returns:
      the value of the encryptedPrivateJwk record component
    • status

      public SigningKeyStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • createdAt

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

      public Instant activatedAt()
      Returns the value of the activatedAt record component.
      Returns:
      the value of the activatedAt record component
    • retiredAt

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