Class ClientApplication
java.lang.Object
io.goobi.viewer.model.security.user.AbstractLicensee
io.goobi.viewer.model.security.clients.ClientApplication
- All Implemented Interfaces:
ILicensee,Serializable
- Author:
- Florian Alpers
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
Nested ClassesModifier and TypeClassDescriptionstatic enumStatus describing if the client is eligible to receive viewing privileges. -
Constructor Summary
ConstructorsConstructorDescriptionInternal constructor for deserializing from database.ClientApplication(ClientApplication source) Cloning constructor.ClientApplication(String identifier) Constructor to create a new ClientApplication from a client request. -
Method Summary
Modifier and TypeMethodDescriptioncanSatisfyAllAccessConditions(Set<String> requiredAccessConditions, String privilegeName, String pi) Check if this client has the privilege of the given privilegeName via its licenses.booleanTwo clients are equal if heirclientIdentifiers are equals.Get the currentaccessStatus.Get theclientIdentifier.Get theclientIp.Get thedateLastAccess.Get thedateRegistered.Get thedescription.getId()Get theid.getName()Get thename.Get thesubnetMask.inthashCode()Use hash code of theclientIdentifier.hasLicense(String licenseName, String privilegeName, String pi) Checks whether the licensee has a license with the given name.voidIf no subnet mask has been set, use the clientIp if available with a '/32' mask.booleanbooleanbooleanChecks if this client requires approval of its registration.booleanChecks if this client requires approval of its registration or this approval has been denied.booleanmatchesClientIdentifier(String identifier) Check if the given identifier matches this instancesclientIdentifier.booleanChecks if the given IP address matches thesubnetMaskof this client.booleanvoidsetAccessStatus(ClientApplication.AccessStatus accessStatus) Set theaccessStatus.voidsetClientIdentifier(String clientIdentifier) Set theclientIdentifier.voidsetClientIp(String clientIp) Set theclientIp.voidsetDateLastAccess(LocalDateTime dateLastAccess) Set thedateLastAccess.voidsetDateRegistered(LocalDateTime dateRegistered) Get thedateRegistered.voidsetDescription(String description) Set thedescription.voidSet theid.voidSet thename.voidsetSubnetMask(String subnetMask) Set thesubnetMask.Methods inherited from class io.goobi.viewer.model.security.user.AbstractLicensee
getAccessPermissionFromMap, getLicenses
-
Constructor Details
-
ClientApplication
public ClientApplication()Internal constructor for deserializing from database. -
ClientApplication
Cloning constructor.- Parameters:
source- client application instance to copy
-
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- theidto set
-
getAccessStatus
Get the currentaccessStatus.- Returns:
- the
accessStatus
-
setAccessStatus
Set theaccessStatus.- Parameters:
accessStatus- theaccessStatusto set
-
getClientIdentifier
Get theclientIdentifier.- Returns:
- the
clientIdentifier
-
setClientIdentifier
Set theclientIdentifier.- Parameters:
clientIdentifier- theclientIdentifierto set
-
getClientIp
Get theclientIp.- Returns:
- the
clientIp
-
setClientIp
Set theclientIp.- Parameters:
clientIp- theclientIpto set
-
getDateRegistered
Get thedateRegistered.- Returns:
- the
dateRegistered
-
setDateRegistered
Get thedateRegistered.- Parameters:
dateRegistered- thedateRegisteredto set
-
getDateLastAccess
Get thedateLastAccess.- Returns:
- the
dateLastAccess
-
setDateLastAccess
Set thedateLastAccess.- Parameters:
dateLastAccess- thedateLastAccessto set
-
getName
Get thename. -
setName
Set thename.- Parameters:
name- thenameto set
-
getDescription
Get thedescription.- Returns:
- the
description
-
setDescription
Set thedescription.- Parameters:
description- thedescriptionto set
-
getAccessType
- Specified by:
getAccessTypein interfaceILicensee- Returns:
- AccessType corresponding to the licensee's class
-
matchesClientIdentifier
Check if the given identifier matches this instancesclientIdentifier.- Parameters:
identifier- client identifier string to compare- Returns:
- true if the given identifier is not null and equals this instances
clientIdentifier
-
isRegistrationPending
public boolean isRegistrationPending()Checks if this client requires approval of its registration.- Returns:
- true if the
accessStatusisClientApplication.AccessStatus.REQUESTED
-
isRegistrationPendingOrDenied
public boolean isRegistrationPendingOrDenied()Checks if this client requires approval of its registration or this approval has been denied.- Returns:
- true if the
accessStatusisClientApplication.AccessStatus.REQUESTEDorClientApplication.AccessStatus.DENIED
-
hashCode
public int hashCode()Use hash code of theclientIdentifier. -
equals
Two clients are equal if heirclientIdentifiers are equals. -
getSubnetMask
Get thesubnetMask.- Returns:
- the
subnetMask
-
setSubnetMask
Set thesubnetMask.- Parameters:
subnetMask- thesubnetMaskto 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 satisfyprivilegeName- The privilege to check forpi- PI of a record to check- Returns:
- true if the privilege should be granted to the client
- Throws:
PresentationExceptionIndexUnreachableExceptionDAOException
-
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:
hasLicensein interfaceILicensee- Overrides:
hasLicensein classAbstractLicensee- Parameters:
licenseName- License name.privilegeName- Required privilege (optional).pi- Checks the privilege in connection with a specific record identifier (optional).- Returns:
- true if the licensee holds a matching license (and the required privilege if specified), false otherwise
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
matchIp
Checks if the given IP address matches thesubnetMaskof this client.- Parameters:
inIp- IP address of the connecting client- Returns:
- true if the given IP address matches the subnet mask of this client application, false otherwise
-
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- IP address of the connecting client- Returns:
- true if remoteAddress may log in; false otherwise
-
isAllClients
- Throws:
DAOException
-