Package co.mastermindcms.common.security
Class UserPrincipalDetailsService
- java.lang.Object
-
- co.mastermindcms.common.security.UserPrincipalDetailsService
-
- All Implemented Interfaces:
org.springframework.security.core.userdetails.UserDetailsService
@Service public class UserPrincipalDetailsService extends java.lang.Object implements org.springframework.security.core.userdetails.UserDetailsService
-
-
Field Summary
Fields Modifier and Type Field Description private CommonProperties
commonProperties
private ProfileRepository
profileRepository
private UserAuditRepository
userAuditRepository
private UserRepository
userRepository
private WebSiteSettingsRepository
webSiteSettingsRepository
-
Constructor Summary
Constructors Constructor Description UserPrincipalDetailsService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAuditSettings(java.lang.String id)
This method deletes the user settings for auditingjava.util.Optional<UserAuditSettings>
loadAuditSettings(java.lang.String id)
This method loads the user settings for auditingorg.springframework.security.core.userdetails.UserDetails
loadUserByUsername(java.lang.String s)
This method calls the user collection to see if it exists and converts it into UserDetailsUserAuditSettings
saveAuditSettings(UserAuditSettings auditSettings)
This method saves the user settings for auditingboolean
userHasAccessToPage(java.lang.String site, java.lang.String login, java.lang.String requestURI)
Checks if the user has access to a specific page on a website.
-
-
-
Field Detail
-
userRepository
@Autowired private UserRepository userRepository
-
userAuditRepository
@Autowired private UserAuditRepository userAuditRepository
-
commonProperties
@Autowired private CommonProperties commonProperties
-
profileRepository
@Autowired private ProfileRepository profileRepository
-
webSiteSettingsRepository
@Autowired private WebSiteSettingsRepository webSiteSettingsRepository
-
-
Method Detail
-
loadUserByUsername
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(java.lang.String s) throws org.springframework.security.core.userdetails.UsernameNotFoundException
This method calls the user collection to see if it exists and converts it into UserDetails- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Parameters:
s
- user login- Returns:
- user details instance
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
- if the user doesn't exist it throws an exception
-
saveAuditSettings
public UserAuditSettings saveAuditSettings(UserAuditSettings auditSettings)
This method saves the user settings for auditing- Parameters:
auditSettings
- user settings entity- Returns:
- data as entity
-
loadAuditSettings
public java.util.Optional<UserAuditSettings> loadAuditSettings(java.lang.String id)
This method loads the user settings for auditing- Parameters:
id
- user settings entity id- Returns:
- data as entity
-
deleteAuditSettings
public void deleteAuditSettings(java.lang.String id)
This method deletes the user settings for auditing- Parameters:
id
- user settings entity id
-
userHasAccessToPage
public boolean userHasAccessToPage(java.lang.String site, java.lang.String login, java.lang.String requestURI)
Checks if the user has access to a specific page on a website.- Parameters:
site
- The identifier of the website.login
- The user's login name.requestURI
- The URI of the page being requested.- Returns:
- true if the user has access to the page, false otherwise.
-
-