Class AccessTicket

java.lang.Object
io.goobi.viewer.model.security.tickets.AccessTicket

@Entity public class AccessTicket extends Object
Represents a time-limited access ticket that grants a user access to a restricted record or download, persisted in the access_tickets database table.

Tickets are issued in response to access requests and are protected by a BCrypt-hashed password. A ticket transitions from a pending request (no password hash) to an active grant once a password is set, and expires after a configurable validity period.

  • Field Details

    • VALIDITY_DAYS

      public static final int VALIDITY_DAYS
      Default validity for a ticket in days.
      See Also:
    • SALT

      public static final String SALT
      Static salt for password hashes.
      See Also:
    • RANDOM

      protected static final Random RANDOM
      Random object for password generation.
    • bcrypt

      protected transient BCrypt bcrypt
  • Constructor Details

    • AccessTicket

      public AccessTicket()
  • Method Details

    • isActive

      public boolean isActive()
      Returns:
      true if ticket granted and not expired; false otherwise
    • isExpired

      public boolean isExpired()
      Returns:
      true if expiration date is in the past; false otherwise
    • isRequest

      public boolean isRequest()
      Returns:
      true if ticket is requested but not yet issued; false otherwise
    • checkPassword

      public boolean checkPassword(String password)
      Parameters:
      password - Password to check
      Returns:
      true if password correct; false otherwise
    • activate

      public void activate()
      Sets the dates.
    • extend

      public void extend(long days)
      Extends the ticket by another days days.
      Parameters:
      days - Number of days to extend
    • reset

      public void reset()
      Resets the ticket's password and expiration date.
    • getDefaultValidityAsString

      public String getDefaultValidityAsString()
      Returns:
      VALIDITY_DAYS
    • getLabel

      public String getLabel()
      Returns the title of the associated record, with a fallback to PI.
      Returns:
      title if present; otherwise pi
    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key for this access ticket
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database identifier to set
    • getType

    • setType

      public void setType(AccessTicket.AccessTicketType type)
    • getDateCreated

      public LocalDateTime getDateCreated()
    • setDateCreated

      public void setDateCreated(LocalDateTime dateCreated)
    • getExpirationDate

      public LocalDateTime getExpirationDate()
    • setExpirationDate

      public void setExpirationDate(LocalDateTime expirationDate)
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
    • getPasswordHash

      public String getPasswordHash()
    • setPasswordHash

      public void setPasswordHash(String passwordHash)
    • getEmail

      public String getEmail()
    • setEmail

      public void setEmail(String email)
    • getPi

      public String getPi()
    • setPi

      public void setPi(String pi)
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getRequestMessage

      public String getRequestMessage()
    • setRequestMessage

      public void setRequestMessage(String requestMessage)