Package com.logicaldoc.web.service
Class SecurityServiceImpl
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.google.gwt.user.server.rpc.jakarta.AbstractRemoteServiceServlet
com.google.gwt.user.server.rpc.jakarta.RemoteServiceServlet
com.logicaldoc.web.service.AbstractRemoteService
com.logicaldoc.web.service.SecurityServiceImpl
- All Implemented Interfaces:
- com.google.gwt.user.client.rpc.RemoteService,- com.google.gwt.user.server.rpc.SerializationPolicyProvider,- SecurityService,- jakarta.servlet.Servlet,- jakarta.servlet.ServletConfig,- Serializable
Implementation of the SecurityService
- Since:
- 6.0
- Author:
- Marco Meschieri - LogicalDOC
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface com.logicaldoc.gui.common.client.services.SecurityServiceSecurityService.Instance
- 
Field SummaryFields inherited from class jakarta.servlet.http.HttpServletLEGACY_DO_HEAD
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddUserToGroup(long groupId, long userId) Adds a user to a groupchangePassword(Long requestorUserId, long userId, String oldPassword, String newPassword, boolean notify) Changes the password of a uservoidchangeStatus(long userId, boolean enabled) Changes the status of a uservoidcloneWorkTimes(long srcUserId, List<Long> userIds, List<Long> groupIds) Clones a work time to a set of other userscreateApiKey(String name) Creates a new API Key for the current uservoiddeleteApiKey(long keyId) Deletes an API KeyvoiddeleteGroup(long groupId) Deletes a given groupvoiddeleteMenu(long menuId) Deletes a menu but only if is not a legacy menu (type not 0)voiddeleteTrustedDevices(List<Long> ids) Deletes a set of trusted devices for the current uservoiddeleteUser(long userId) Deletes a given userstatic GUITenantfromTenant(Tenant tenant) Generates a password using the configured policies.generatePassword2(int length, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences) Generates a passwordgetGroup(long groupId) Loads a given group from the databaseRetrieves the specified menuRetrieves the accessible menus children of a given parentgetSession(String locale, String sid) Logs-in a user by an existing session ID (session reuse)static GUITenantgetTenant(long tenantId) static GUITenantgetUser(long userId) Loads a given user from the databaseisTrustedDevice(String deviceId) Check if the saved device ID is trusted for the current uservoidKill the session with the given sidRetrieves the list of actually blocked usernames and IPs detected as Brute Force AttackloadSession(Session session, String locale) Used internally by login procedures, instantiates a new GUISession by a given authenticated userLoads security settingsvoidlogout()Logs out the current uservoidremoveBlockedEntities(List<Long> ids) Removes blocked entries detected as Brute Force AttackvoidremoveFromGroup(long groupId, List<Long> userIds) Removes users from a groupvoidreplicateUsersSettings(long masterUserId, List<Long> userIds, boolean gui, boolean groups) Replicates the settings of a given user to a selection of other usersvoidresetAvatar(long userId) Resets the avatar to the default onevoidApplies all security settings to menuvoidsaveAvatar(long userId) Saves an uploaded image as the user's avatarCreates or updates a groupsaveInterfaceSettings(GUIUser user) Saves the interface settings onlySaves a menuvoidSaves a set of menussaveProfile(GUIUser guiUser) Saves the profile data onlybooleansaveSettings(GUISecuritySettings settings) Saves security settingsCreates or updates a usersearchUsers(String username, String groupId) Searches for userssyncGeolocationDB(String key) Downloads the most recent version of the Geolocation databasetrustDevice(String label) Permanently trusts the current device for the current uservoidupdateApiKey(long keyId, String newName) Updates an API KeyvoidupdateDeviceLabel(long deviceId, String label) Updates the label of a devicevalidatePassword(String password, int minLength, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences) Validates a passwordMethods inherited from class com.logicaldoc.web.service.AbstractRemoteServicesetThreadRequestMethods inherited from class com.google.gwt.user.server.rpc.jakarta.RemoteServiceServletgetSerializationPolicy, init, processCall, processCall, processPostMethods inherited from class com.google.gwt.user.server.rpc.jakarta.AbstractRemoteServiceServletdoPostMethods inherited from class jakarta.servlet.http.HttpServletserviceMethods inherited from class jakarta.servlet.GenericServletdestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
- 
Constructor Details- 
SecurityServiceImplpublic SecurityServiceImpl()
 
- 
- 
Method Details- 
getTenant
- 
fromTenant
- 
getTenant- Throws:
- PersistenceException
 
- 
loadSessionUsed internally by login procedures, instantiates a new GUISession by a given authenticated user- Parameters:
- session- the current session
- locale- the current locale
- Returns:
- session details
- Throws:
- ServerException- a generic error
 
- 
getSessionDescription copied from interface:SecurityServiceLogs-in a user by an existing session ID (session reuse)- Specified by:
- getSessionin interface- SecurityService
- Parameters:
- locale- the currently used language specification
- sid- the session ID (optional), if not provided it is taken by cookies
- Returns:
- session informations
 
- 
logoutpublic void logout()Description copied from interface:SecurityServiceLogs out the current user- Specified by:
- logoutin interface- SecurityService
 
- 
changePasswordpublic GUIValue changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword, boolean notify) Description copied from interface:SecurityServiceChanges the password of a user- Specified by:
- changePasswordin interface- SecurityService
- Parameters:
- requestorUserId- The user Identifier of the requestor
- userId- The user Identifier
- oldPassword- can be null
- newPassword- the new password
- notify- If the new credentials have to be notified
- Returns:
- the error code and message. 0 if all went ok, 1 if the password is incorrect, 2 if the new password cannot be notified, 3 if the password has been already used, otherwise a positive number grater than 3
 
- 
addUserToGroupDescription copied from interface:SecurityServiceAdds a user to a group- Specified by:
- addUserToGroupin interface- SecurityService
- Parameters:
- groupId- identifier of the group
- userId- identifier of the user
- Throws:
- ServerException- error generated in the server application
 
- 
deleteGroupDescription copied from interface:SecurityServiceDeletes a given group- Specified by:
- deleteGroupin interface- SecurityService
- Parameters:
- groupId- identifier of the group
- Throws:
- ServerException- error generated in the server application
 
- 
deleteUserDescription copied from interface:SecurityServiceDeletes a given user- Specified by:
- deleteUserin interface- SecurityService
- Parameters:
- userId- identifier of the user
- Throws:
- ServerException- error generated in the server application
 
- 
getGroupDescription copied from interface:SecurityServiceLoads a given group from the database- Specified by:
- getGroupin interface- SecurityService
- Parameters:
- groupId- identifier of the group
- Returns:
- group retrieved from the server application
- Throws:
- ServerException- error generated in the server application
 
- 
getUserDescription copied from interface:SecurityServiceLoads a given user from the database- Specified by:
- getUserin interface- SecurityService
- Parameters:
- userId- identifier of the user
- Returns:
- the user retrieved from the server application
- Throws:
- ServerException- error generated in the server application
 
- 
removeFromGroupDescription copied from interface:SecurityServiceRemoves users from a group- Specified by:
- removeFromGroupin interface- SecurityService
- Parameters:
- groupId- identifier of the group
- userIds- user identifiers
- Throws:
- ServerException- error generated in the server application
 
- 
saveGroupDescription copied from interface:SecurityServiceCreates or updates a group- Specified by:
- saveGroupin interface- SecurityService
- Parameters:
- group- the group to save
- Returns:
- the updated group
- Throws:
- ServerException- error generated in the server application
 
- 
saveUserDescription copied from interface:SecurityServiceCreates or updates a user- Specified by:
- saveUserin interface- SecurityService
- Parameters:
- guiUser- the user to save
- info- informations about the User Interface
- Returns:
- the saved user
- Throws:
- ServerException- error generated in the server application
 
- 
saveProfileDescription copied from interface:SecurityServiceSaves the profile data only- Specified by:
- saveProfilein interface- SecurityService
- Parameters:
- guiUser- the user to save
- Returns:
- the updated user
- Throws:
- ServerException- error generated in the server application
 
- 
saveInterfaceSettingsDescription copied from interface:SecurityServiceSaves the interface settings only- Specified by:
- saveInterfaceSettingsin interface- SecurityService
- Parameters:
- user- the user to save
- Returns:
- the updated user
- Throws:
- ServerException- error generated in the server application
 
- 
killDescription copied from interface:SecurityServiceKill the session with the given sid- Specified by:
- killin interface- SecurityService
- Parameters:
- sid- identifier of the session
 
- 
loadSettingsDescription copied from interface:SecurityServiceLoads security settings- Specified by:
- loadSettingsin interface- SecurityService
- Returns:
- the security settings
- Throws:
- ServerException- error generated in the server application
 
- 
saveSettingsDescription copied from interface:SecurityServiceSaves security settings- Specified by:
- saveSettingsin interface- SecurityService
- Parameters:
- settings- settings about security
- Returns:
- True if the application has to be restarted
- Throws:
- ServerException- error generated in the server application
 
- 
saveACLDescription copied from interface:SecurityServiceApplies all security settings to menu- Specified by:
- saveACLin interface- SecurityService
- Parameters:
- menu- the menu
- Throws:
- ServerException- error generated in the server application
 
- 
deleteMenuDescription copied from interface:SecurityServiceDeletes a menu but only if is not a legacy menu (type not 0)- Specified by:
- deleteMenuin interface- SecurityService
- Parameters:
- menuId- the menu to delete
- Throws:
- ServerException- error generated in the server application
 
- 
saveMenusDescription copied from interface:SecurityServiceSaves a set of menus- Specified by:
- saveMenusin interface- SecurityService
- Parameters:
- menus- the menus to save
- locale- currently selected locale
- Throws:
- ServerException- error generated in the server application
 
- 
saveMenuDescription copied from interface:SecurityServiceSaves a menu- Specified by:
- saveMenuin interface- SecurityService
- Parameters:
- guiMenu- the menu to save
- locale- currently selected locale
- Returns:
- the saved menu
- Throws:
- ServerException- error generated in the server application
 
- 
getMenuspublic List<GUIMenu> getMenus(long parentId, String locale, boolean enabledOnly) throws ServerException Description copied from interface:SecurityServiceRetrieves the accessible menus children of a given parent- Specified by:
- getMenusin interface- SecurityService
- Parameters:
- parentId- identifier of the parent menu
- locale- currently selected locale
- enabledOnly- to retrieve just the enabled menus
- Returns:
- the accessible children
- Throws:
- ServerException- error generated in the server application
 
- 
getMenuDescription copied from interface:SecurityServiceRetrieves the specified menu- Specified by:
- getMenuin interface- SecurityService
- Parameters:
- menuId- identifier of the menu
- locale- currently selected locale
- Returns:
- the menu retrieved from the server application
- Throws:
- ServerException- error generated in the server application
 
- 
searchUsersDescription copied from interface:SecurityServiceSearches for users- Specified by:
- searchUsersin interface- SecurityService
- Parameters:
- username- The username used in the like operator (optional)
- groupId- The group ID (optional)
- Returns:
- Array of found users
- Throws:
- ServerException- error generated in the server application
 
- 
loadBlockedEntitiesDescription copied from interface:SecurityServiceRetrieves the list of actually blocked usernames and IPs detected as Brute Force Attack- Specified by:
- loadBlockedEntitiesin interface- SecurityService
- Returns:
- the array of blocked usernames and IPs
- Throws:
- ServerException- error generated in the server application
 
- 
removeBlockedEntitiesDescription copied from interface:SecurityServiceRemoves blocked entries detected as Brute Force Attack- Specified by:
- removeBlockedEntitiesin interface- SecurityService
- Parameters:
- ids- identifiers of entities from the BFA list
- Throws:
- ServerException- error generated in the server application
 
- 
replicateUsersSettingspublic void replicateUsersSettings(long masterUserId, List<Long> userIds, boolean gui, boolean groups) throws ServerException Description copied from interface:SecurityServiceReplicates the settings of a given user to a selection of other users- Specified by:
- replicateUsersSettingsin interface- SecurityService
- Parameters:
- masterUserId- identifier of the user with the settings you want to replicate
- userIds- identifiers of the users to replicate the settings to
- gui- if the user interface settings must be replicated
- groups- if the groups must be replicated(the read-only users will not be affected by this flag)
- Throws:
- ServerException- error generated in the server application
 
- 
updateDeviceLabelDescription copied from interface:SecurityServiceUpdates the label of a device- Specified by:
- updateDeviceLabelin interface- SecurityService
- Parameters:
- deviceId- identifier of the device to update
- label- label to assign to the current device
- Throws:
- ServerException- error generated in the server application
 
- 
trustDeviceDescription copied from interface:SecurityServicePermanently trusts the current device for the current user- Specified by:
- trustDevicein interface- SecurityService
- Parameters:
- label- optional label to assign to the current device
- Returns:
- the ID of the trusted device
- Throws:
- ServerException- error generated in the server application
 
- 
isTrustedDeviceDescription copied from interface:SecurityServiceCheck if the saved device ID is trusted for the current user- Specified by:
- isTrustedDevicein interface- SecurityService
- Parameters:
- deviceId- identifier of the device
- Returns:
- if the device is trusted or not
- Throws:
- ServerException- error generated in the server application
 
- 
deleteTrustedDevicesDescription copied from interface:SecurityServiceDeletes a set of trusted devices for the current user- Specified by:
- deleteTrustedDevicesin interface- SecurityService
- Parameters:
- ids- identifiers of the devices to delete
- Throws:
- ServerException- error generated in the server application
 
- 
syncGeolocationDBDescription copied from interface:SecurityServiceDownloads the most recent version of the Geolocation database- Specified by:
- syncGeolocationDBin interface- SecurityService
- Parameters:
- key- the API key
- Returns:
- the current database version
- Throws:
- ServerException- error generated in the server application
 
- 
saveAvatarDescription copied from interface:SecurityServiceSaves an uploaded image as the user's avatar- Specified by:
- saveAvatarin interface- SecurityService
- Parameters:
- userId- Identifier of the user
- Throws:
- ServerException- error generated in the server application
 
- 
resetAvatarDescription copied from interface:SecurityServiceResets the avatar to the default one- Specified by:
- resetAvatarin interface- SecurityService
- Parameters:
- userId- Identifier of the user
- Throws:
- ServerException- error generated in the server application
 
- 
cloneWorkTimespublic void cloneWorkTimes(long srcUserId, List<Long> userIds, List<Long> groupIds) throws ServerException Description copied from interface:SecurityServiceClones a work time to a set of other users- Specified by:
- cloneWorkTimesin interface- SecurityService
- Parameters:
- srcUserId- identifier of the user with the work time you want to clone
- userIds- direct ids of users to clone the working time to
- groupIds- the groups of users to clone the working time to
- Throws:
- ServerException- generic error
 
- 
changeStatusDescription copied from interface:SecurityServiceChanges the status of a user- Specified by:
- changeStatusin interface- SecurityService
- Parameters:
- userId- The user Identifier
- enabled- If the user must be enabled or not
- Throws:
- ServerException- error generated in the server application
 
- 
generatePasswordDescription copied from interface:SecurityServiceGenerates a password using the configured policies.- Specified by:
- generatePasswordin interface- SecurityService
- Returns:
- the generated password
- Throws:
- InvalidSessionServerException
 
- 
generatePassword2public String generatePassword2(int length, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences) Description copied from interface:SecurityServiceGenerates a password- Specified by:
- generatePassword2in interface- SecurityService
- Parameters:
- length- dimension of the password
- uppercaseChars- minimum number of upper case chars
- lowercaseChars- minimum number of lower case chars
- digits- minimum number of digits
- specialChars- minimum number of special chars
- maxSequenceSize- maximum size of a sequence
- maxOccurrences- maximum number of occurrences of the same char
- Returns:
- the generated password
 
- 
validatePasswordpublic List<String> validatePassword(String password, int minLength, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences) Description copied from interface:SecurityServiceValidates a password- Specified by:
- validatePasswordin interface- SecurityService
- Parameters:
- password- the password to validate
- minLength- dimension of the password
- uppercaseChars- minimum number of upper case chars
- lowercaseChars- minimum number of lower case chars
- digits- minimum number of digits
- specialChars- minimum number of special chars
- maxSequenceSize- maximum size of a sequence
- maxOccurrences- maximum number of occurrences of the same char
- Returns:
- the reasons for the failure or empty
 
- 
createApiKeyDescription copied from interface:SecurityServiceCreates a new API Key for the current user- Specified by:
- createApiKeyin interface- SecurityService
- Parameters:
- name- The name to give to the new key
- Returns:
- The newly generated key
- Throws:
- ServerException- error generated in the server application
 
- 
deleteApiKeyDescription copied from interface:SecurityServiceDeletes an API Key- Specified by:
- deleteApiKeyin interface- SecurityService
- Parameters:
- keyId- Identifier of the API Key
- Throws:
- ServerException- error generated in the server application
 
- 
updateApiKeyDescription copied from interface:SecurityServiceUpdates an API Key- Specified by:
- updateApiKeyin interface- SecurityService
- Parameters:
- keyId- Identifier of the API Key
- newName- The new name to assign
- Throws:
- ServerException- error generated in the server application
 
 
-