Class ClientApplication

java.lang.Object
io.goobi.viewer.model.security.clients.ClientApplication
All Implemented Interfaces:
ILicensee, Serializable

@Entity public class ClientApplication extends Object implements ILicensee, Serializable
Author:
florian This class represents clients accessing the viewer not through web-browsers but using dedicated client-applications which must register with the server to view any data but which may also enjoy unique viewing rights via dedicated Licenses
See Also:
  • Constructor Details

    • ClientApplication

      public ClientApplication()
      internal constructor for deserializing from database
    • ClientApplication

      public ClientApplication(ClientApplication source)
      Cloning constructor
      Parameters:
      source -
    • ClientApplication

      public ClientApplication(String identifier)
      constructor to create a new ClientApplication from a client request
      Parameters:
      identifier - the client identifier
  • Method Details

    • getId

      public Long getId()
      Get the id
      Returns:
      the id
    • setId

      public void setId(Long id)
      Set the id
      Parameters:
      id - the id to set
    • getAccessStatus

      public ClientApplication.AccessStatus getAccessStatus()
      Get the current accessStatus
      Returns:
      the accessStatus
    • setAccessStatus

      public void setAccessStatus(ClientApplication.AccessStatus accessStatus)
      Set the accessStatus
      Parameters:
      accessStatus - the accessStatus to set
    • getClientIdentifier

      public String getClientIdentifier()
      Get the clientIdentifier
      Returns:
      the clientIdentifier
    • setClientIdentifier

      public void setClientIdentifier(String clientIdentifier)
      Set the clientIdentifier
      Parameters:
      clientIdentifier - the clientIdentifier to set
    • getClientIp

      public String getClientIp()
      Get the clientIp
      Returns:
      the clientIp
    • setClientIp

      public void setClientIp(String clientIp)
      Set the clientIp
      Parameters:
      clientIp - the clientIp to set
    • getDateRegistered

      public LocalDateTime getDateRegistered()
      Get the dateRegistered
      Returns:
      the dateRegistered
    • setDateRegistered

      public void setDateRegistered(LocalDateTime dateRegistered)
      Get the dateRegistered
      Parameters:
      dateRegistered - the dateRegistered to set
    • getDateLastAccess

      public LocalDateTime getDateLastAccess()
      Get the dateLastAccess
      Returns:
      the dateLastAccess
    • setDateLastAccess

      public void setDateLastAccess(LocalDateTime dateLastAccess)
      Set the dateLastAccess
      Parameters:
      dateLastAccess - the dateLastAccess to set
    • getName

      public String getName()
      Get the name
      Specified by:
      getName in interface ILicensee
      Returns:
      the name
    • setName

      public void setName(String name)
      Set the name
      Parameters:
      name - the name to set
    • getDescription

      public String getDescription()
      Get the description
      Returns:
      the description
    • setDescription

      public void setDescription(String description)
      Set the description
      Parameters:
      description - the description to set
    • matchesClientIdentifier

      public boolean matchesClientIdentifier(String identifier)
      Check if the given identifier matches this instances clientIdentifier
      Parameters:
      identifier -
      Returns:
      true if the given identifier is not null and equals this instances clientIdentifier
    • isRegistrationPending

      public boolean isRegistrationPending()
      Check if this client requires approval of its registration
      Returns:
      true if the accessStatus is ClientApplication.AccessStatus.REQUESTED
    • isRegistrationPendingOrDenied

      public boolean isRegistrationPendingOrDenied()
      Check if this client requires approval of its registration or this approval has been denied
      Returns:
      true if the accessStatus is ClientApplication.AccessStatus.REQUESTED or ClientApplication.AccessStatus.DENIED
    • hashCode

      public int hashCode()
      Use hash code of the clientIdentifier
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Two clients are equal if heir clientIdentifiers are equals
      Overrides:
      equals in class Object
    • getLicenses

      public List<License> getLicenses()
      Get the Licenses this client is privileged to
      Specified by:
      getLicenses in interface ILicensee
      Returns:
      the licenses
    • addLicense

      public boolean addLicense(License license)
      Add a License to the licenses
      Specified by:
      addLicense in interface ILicensee
      Parameters:
      license -
      Returns:
      true if added successfully; false otherwise
    • removeLicense

      public boolean removeLicense(License license)
      Remove License from the licenses
      Specified by:
      removeLicense in interface ILicensee
      Parameters:
      license - a License object.
      Returns:
      a boolean.
    • getSubnetMask

      public String getSubnetMask()
      Get the subnetMask
      Returns:
      the subnetMask
    • setSubnetMask

      public void setSubnetMask(String subnetMask)
      Set the subnetMask
      Parameters:
      subnetMask - the subnetMask to set
    • canSatisfyAllAccessConditions

      public AccessPermission canSatisfyAllAccessConditions(Set<String> requiredAccessConditions, String privilegeName, String pi) throws PresentationException, IndexUnreachableException, DAOException
      Check if this client has the privilege of the given privilegeName via its licenses
      Parameters:
      requiredAccessConditions - List of access condition names to satisfy
      privilegeName - The privilege to check for
      pi - PI of a record to check
      Returns:
      true if the privilege should be granted to the client
      Throws:
      PresentationException
      IndexUnreachableException
      DAOException
    • hasLicense

      public AccessPermission hasLicense(String licenseName, String privilegeName, String pi) throws PresentationException, IndexUnreachableException
      Checks whether the licensee has a license with the given name. IF a privilege name is passed, the licensee must also have this privilege for that license.
      Specified by:
      hasLicense in interface ILicensee
      Parameters:
      licenseName - License name.
      privilegeName - Required privilege (optional).
      pi - Checks the privilege in connection with a specific record identifier (optional).
      Returns:
      a boolean.
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • matchIp

      public boolean matchIp(String inIp)
      Check if the given IP address matches the subnetMask of this client
      Parameters:
      inIp - a String object.
      Returns:
      a boolean.
    • initializeSubnetMask

      public void initializeSubnetMask()
      If no subnet mask has been set, use the clientIp if available with a '/32' mask
    • isAccessGranted

      public boolean isAccessGranted()
    • mayLogIn

      public boolean mayLogIn(String remoteAddress)
      Parameters:
      remoteAddress -
      Returns:
      true if remoteAddress may log in; false otherwise
    • isAllClients

      public boolean isAllClients() throws DAOException
      Throws:
      DAOException