Record Class ApiKey

java.lang.Object
java.lang.Record
org.jwcarman.who.apikey.ApiKey
Record Components:
id - the key's credential id
name - the key's name
scopes - the permissions the key may use, at most
createdAt - when the key was made
expiresAt - when the key stops, or stopped, signing in
lastUsedAt - when it last signed in, to within the last-used interval; null when it never has
expired - whether expiresAt had passed when the list was made

public record ApiKey(UUID id, String name, Set<String> scopes, Instant createdAt, Instant expiresAt, Instant lastUsedAt, boolean expired) extends Record
An identity's key as ApiKeyService.findByIdentity(UUID) lists it, with no secret in it.
  • Constructor Details

  • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • scopes

      public Set<String> scopes()
      Returns the value of the scopes record component.
      Returns:
      the value of the scopes record component
    • createdAt

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

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • lastUsedAt

      public Instant lastUsedAt()
      Returns the value of the lastUsedAt record component.
      Returns:
      the value of the lastUsedAt record component
    • expired

      public boolean expired()
      Returns the value of the expired record component.
      Returns:
      the value of the expired record component