Class ClientApplication
java.lang.Object
io.goobi.viewer.model.security.clients.ClientApplication
- All Implemented Interfaces:
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Status describing if the client is eligible to receive viewing privileges -
Constructor Summary
ConstructorDescriptioninternal constructor for deserializing from databaseClientApplication
(ClientApplication source) Cloning constructorClientApplication
(String identifier) constructor to create a new ClientApplication from a client request -
Method Summary
Modifier and TypeMethodDescriptionboolean
addLicense
(License license) Add aLicense
to thelicenses
canSatisfyAllAccessConditions
(Set<String> requiredAccessConditions, String privilegeName, String pi) Check if this client has the privilege of the given privilegeName via itslicenses
boolean
Two clients are equal if heirclientIdentifier
s are equalsGet the currentaccessStatus
Get theclientIdentifier
Get theclientIp
Get thedateLastAccess
Get thedateRegistered
Get thedescription
getId()
Get theid
Get theLicense
s this client is privileged togetName()
Get thename
Get thesubnetMask
int
hashCode()
Use hash code of theclientIdentifier
hasLicense
(String licenseName, String privilegeName, String pi) Checks whether the licensee has a license with the given name.void
If no subnet mask has been set, use the clientIp if available with a '/32' maskboolean
boolean
boolean
Check if this client requires approval of its registrationboolean
Check if this client requires approval of its registration or this approval has been deniedboolean
matchesClientIdentifier
(String identifier) Check if the given identifier matches this instancesclientIdentifier
boolean
Check if the given IP address matches thesubnetMask
of this clientboolean
boolean
removeLicense
(License license) RemoveLicense
from thelicenses
void
setAccessStatus
(ClientApplication.AccessStatus accessStatus) Set theaccessStatus
void
setClientIdentifier
(String clientIdentifier) Set theclientIdentifier
void
setClientIp
(String clientIp) Set theclientIp
void
setDateLastAccess
(LocalDateTime dateLastAccess) Set thedateLastAccess
void
setDateRegistered
(LocalDateTime dateRegistered) Get thedateRegistered
void
setDescription
(String description) Set thedescription
void
Set theid
void
Set thename
void
setSubnetMask
(String subnetMask) Set thesubnetMask
-
Constructor Details
-
ClientApplication
public ClientApplication()internal constructor for deserializing from database -
ClientApplication
Cloning constructor- Parameters:
source
-
-
ClientApplication
constructor to create a new ClientApplication from a client request- Parameters:
identifier
- the client identifier
-
-
Method Details
-
getId
Get theid
- Returns:
- the
id
-
setId
Set theid
- Parameters:
id
- theid
to set
-
getAccessStatus
Get the currentaccessStatus
- Returns:
- the
accessStatus
-
setAccessStatus
Set theaccessStatus
- Parameters:
accessStatus
- theaccessStatus
to set
-
getClientIdentifier
Get theclientIdentifier
- Returns:
- the
clientIdentifier
-
setClientIdentifier
Set theclientIdentifier
- Parameters:
clientIdentifier
- theclientIdentifier
to set
-
getClientIp
Get theclientIp
- Returns:
- the
clientIp
-
setClientIp
Set theclientIp
- Parameters:
clientIp
- theclientIp
to set
-
getDateRegistered
Get thedateRegistered
- Returns:
- the
dateRegistered
-
setDateRegistered
Get thedateRegistered
- Parameters:
dateRegistered
- thedateRegistered
to set
-
getDateLastAccess
Get thedateLastAccess
- Returns:
- the
dateLastAccess
-
setDateLastAccess
Set thedateLastAccess
- Parameters:
dateLastAccess
- thedateLastAccess
to set
-
getName
Get thename
-
setName
Set thename
- Parameters:
name
- thename
to set
-
getDescription
Get thedescription
- Returns:
- the
description
-
setDescription
Set thedescription
- Parameters:
description
- thedescription
to set
-
matchesClientIdentifier
Check if the given identifier matches this instancesclientIdentifier
- 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
isClientApplication.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
isClientApplication.AccessStatus.REQUESTED
orClientApplication.AccessStatus.DENIED
-
hashCode
public int hashCode()Use hash code of theclientIdentifier
-
equals
Two clients are equal if heirclientIdentifier
s are equals -
getLicenses
Get theLicense
s this client is privileged to- Specified by:
getLicenses
in interfaceILicensee
- Returns:
- the licenses
-
addLicense
Add aLicense
to thelicenses
- Specified by:
addLicense
in interfaceILicensee
- Parameters:
license
-- Returns:
- true if added successfully; false otherwise
-
removeLicense
RemoveLicense
from thelicenses
- Specified by:
removeLicense
in interfaceILicensee
- Parameters:
license
- aLicense
object.- Returns:
- a boolean.
-
getSubnetMask
Get thesubnetMask
- Returns:
- the
subnetMask
-
setSubnetMask
Set thesubnetMask
- Parameters:
subnetMask
- thesubnetMask
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 itslicenses
- Parameters:
requiredAccessConditions
- List of access condition names to satisfyprivilegeName
- The privilege to check forpi
- 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 interfaceILicensee
- 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
Check if the given IP address matches thesubnetMask
of this client- Parameters:
inIp
- aString
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
- Parameters:
remoteAddress
-- Returns:
- true if remoteAddress may log in; false otherwise
-
isAllClients
- Throws:
DAOException
-