Interface SecurityService
-
- All Known Implementing Classes:
SecurityServiceImpl
public interface SecurityService
- Author:
- Dejan Brkic
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
changePassword(String username, String current, String newPassword)
Change passwordint
getAllUsersTotal()
Get all usersorg.springframework.security.core.Authentication
getAuthentication()
Returns theAuthentication
for the current user or null if not user is authenticated.String
getCurrentUser()
Returns the username of the current user OR NULL if no user is authenticatedSet<String>
getUserPermissions(String site, String path, String user, List<String> groups)
Set<String>
getUserPermissions(String site, String path, List<String> groups)
Map<String,Object>
getUserProfile(String user)
Map<String,Object>
getUserProfileByGitName(String gitName)
Get user by git name.Set<String>
getUserRoles(String site)
Set<String>
getUserRoles(String site, String user)
Set<String>
getUserRoles(String site, String user, boolean includeGlobal)
boolean
isSiteAdmin(String username, String site)
Check if given user is site adminboolean
resetPassword(String username, String newPassword)
Reset user passwordboolean
userExists(String username)
Check if user exists
-
-
-
Method Detail
-
getCurrentUser
String getCurrentUser()
Returns the username of the current user OR NULL if no user is authenticated- Returns:
- current user
-
getAuthentication
org.springframework.security.core.Authentication getAuthentication()
Returns theAuthentication
for the current user or null if not user is authenticated.- Returns:
- authentication
-
getUserProfile
Map<String,Object> getUserProfile(String user) throws ServiceLayerException, UserNotFoundException
-
getUserProfileByGitName
Map<String,Object> getUserProfileByGitName(String gitName) throws ServiceLayerException, UserNotFoundException
Get user by git name. Special use case because git stores user as string of first and last name separated by ' '- Parameters:
gitName
- first and last name separated with ' '- Returns:
- user
- Throws:
ServiceLayerException
- general service errorUserNotFoundException
- user not found
-
getUserPermissions
Set<String> getUserPermissions(String site, String path, String user, List<String> groups)
-
userExists
boolean userExists(String username) throws ServiceLayerException
Check if user exists- Parameters:
username
- username- Returns:
- true if user exists
- Throws:
ServiceLayerException
- general service error
-
getAllUsersTotal
int getAllUsersTotal() throws ServiceLayerException
Get all users- Returns:
- number of all users
- Throws:
ServiceLayerException
- general service error
-
changePassword
boolean changePassword(String username, String current, String newPassword) throws PasswordDoesNotMatchException, UserExternallyManagedException, ServiceLayerException
Change password- Parameters:
username
- usernamecurrent
- current passwordnewPassword
- new password- Returns:
- true if user's password is successfully changed
- Throws:
UserExternallyManagedException
- user is externally managedPasswordDoesNotMatchException
- password does not match stored passwordServiceLayerException
- general service error
-
resetPassword
boolean resetPassword(String username, String newPassword) throws UserNotFoundException, UserExternallyManagedException, ServiceLayerException
Reset user password- Parameters:
username
- usernamenewPassword
- new password- Returns:
- true if user's password is successfully reset
- Throws:
UserNotFoundException
- user not foundUserExternallyManagedException
- user externally managedServiceLayerException
- general service error
-
-