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
Nested ClassesModifier and TypeClassDescriptionstatic enumStatus describing if the client is eligible to receive viewing privileges -
Constructor Summary
ConstructorsConstructorDescriptioninternal 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 TypeMethodDescriptionbooleanaddLicense(License license) Add aLicenseto thelicensescanSatisfyAllAccessConditions(Set<String> requiredAccessConditions, String privilegeName, String pi) Check if this client has the privilege of the given privilegeName via itslicensesbooleanTwo clients are equal if heirclientIdentifiers are equalsGet the currentaccessStatusGet theclientIdentifierGet theclientIpGet thedateLastAccessGet thedateRegisteredGet thedescriptiongetId()Get theidGet theLicenses this client is privileged togetName()Get thenameGet thesubnetMaskinthashCode()Use hash code of theclientIdentifierhasLicense(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' maskbooleanbooleanbooleanCheck if this client requires approval of its registrationbooleanCheck if this client requires approval of its registration or this approval has been deniedbooleanmatchesClientIdentifier(String identifier) Check if the given identifier matches this instancesclientIdentifierbooleanCheck if the given IP address matches thesubnetMaskof this clientbooleanbooleanremoveLicense(License license) RemoveLicensefrom thelicensesvoidsetAccessStatus(ClientApplication.AccessStatus accessStatus) Set theaccessStatusvoidsetClientIdentifier(String clientIdentifier) Set theclientIdentifiervoidsetClientIp(String clientIp) Set theclientIpvoidsetDateLastAccess(LocalDateTime dateLastAccess) Set thedateLastAccessvoidsetDateRegistered(LocalDateTime dateRegistered) Get thedateRegisteredvoidsetDescription(String description) Set thedescriptionvoidSet theidvoidSet thenamevoidsetSubnetMask(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- 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
-
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
accessStatusisClientApplication.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
accessStatusisClientApplication.AccessStatus.REQUESTEDorClientApplication.AccessStatus.DENIED
-
hashCode
public int hashCode()Use hash code of theclientIdentifier -
equals
Two clients are equal if heirclientIdentifiers are equals -
getLicenses
Get theLicenses this client is privileged to- Specified by:
getLicensesin interfaceILicensee- Returns:
- the licenses
-
addLicense
Add aLicenseto thelicenses- Specified by:
addLicensein interfaceILicensee- Parameters:
license-- Returns:
- true if added successfully; false otherwise
-
removeLicense
RemoveLicensefrom thelicenses- Specified by:
removeLicensein interfaceILicensee- Parameters:
license- aLicenseobject.- Returns:
- a boolean.
-
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 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:
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- 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 thesubnetMaskof this client- Parameters:
inIp- aStringobject.- 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
-