Class ImpersonationService
- java.lang.Object
-
- com.netgrif.application.engine.impersonation.service.ImpersonationService
-
- All Implemented Interfaces:
IImpersonationService
@Service public class ImpersonationService extends java.lang.Object implements IImpersonationService
-
-
Field Summary
Fields Modifier and Type Field Description protected IHistoryService
historyService
protected IImpersonationAuthorizationService
impersonationAuthorizationService
protected ImpersonatorRepository
impersonatorRepository
protected ImpersonationProperties
properties
protected ISecurityContextService
securityContextService
protected IImpersonationSessionService
sessionService
protected IUserService
userService
-
Constructor Summary
Constructors Constructor Description ImpersonationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IUser
applyRolesAndAuthorities(IUser impersonated, java.lang.String impersonatorId, java.util.List<Case> configs)
protected LoggedUser
doImpersonate(LoggedUser loggedUser, LoggedUser impersonatedLogged, java.util.List<Case> configs)
LoggedUser
endImpersonation()
LoggedUser
endImpersonation(LoggedUser impersonator)
java.util.Optional<Impersonator>
findImpersonator(java.lang.String impersonatorId)
protected java.time.LocalDateTime
getConfigValidToTime(Case config)
LoggedUser
impersonateByConfig(java.lang.String configId)
LoggedUser
impersonateUser(java.lang.String impersonatedId)
void
onSessionDestroy(LoggedUser impersonator)
IUser
reloadImpersonatedUserRoles(IUser impersonated, java.lang.String impersonatorId)
void
removeImpersonator(java.lang.String impersonatorId)
void
removeImpersonatorByImpersonated(java.lang.String impersonatedId)
protected void
updateImpersonatedId(LoggedUser loggedUser, java.lang.String id, java.util.List<Case> configs)
protected void
updateImpersonatedId(LoggedUser loggedUser, java.lang.String id, java.util.List<Case> configs, java.time.LocalDateTime validUntil)
-
-
-
Field Detail
-
properties
@Autowired protected ImpersonationProperties properties
-
userService
@Autowired protected IUserService userService
-
historyService
@Autowired protected IHistoryService historyService
-
sessionService
@Autowired protected IImpersonationSessionService sessionService
-
securityContextService
@Autowired protected ISecurityContextService securityContextService
-
impersonatorRepository
@Autowired protected ImpersonatorRepository impersonatorRepository
-
impersonationAuthorizationService
@Autowired protected IImpersonationAuthorizationService impersonationAuthorizationService
-
-
Method Detail
-
impersonateUser
public LoggedUser impersonateUser(java.lang.String impersonatedId) throws ImpersonatedUserHasSessionException
- Specified by:
impersonateUser
in interfaceIImpersonationService
- Throws:
ImpersonatedUserHasSessionException
-
impersonateByConfig
public LoggedUser impersonateByConfig(java.lang.String configId) throws ImpersonatedUserHasSessionException
- Specified by:
impersonateByConfig
in interfaceIImpersonationService
- Throws:
ImpersonatedUserHasSessionException
-
doImpersonate
protected LoggedUser doImpersonate(LoggedUser loggedUser, LoggedUser impersonatedLogged, java.util.List<Case> configs) throws ImpersonatedUserHasSessionException
-
findImpersonator
public java.util.Optional<Impersonator> findImpersonator(java.lang.String impersonatorId)
- Specified by:
findImpersonator
in interfaceIImpersonationService
-
removeImpersonatorByImpersonated
public void removeImpersonatorByImpersonated(java.lang.String impersonatedId)
- Specified by:
removeImpersonatorByImpersonated
in interfaceIImpersonationService
-
removeImpersonator
public void removeImpersonator(java.lang.String impersonatorId)
- Specified by:
removeImpersonator
in interfaceIImpersonationService
-
endImpersonation
public LoggedUser endImpersonation()
- Specified by:
endImpersonation
in interfaceIImpersonationService
-
endImpersonation
public LoggedUser endImpersonation(LoggedUser impersonator)
- Specified by:
endImpersonation
in interfaceIImpersonationService
-
onSessionDestroy
public void onSessionDestroy(LoggedUser impersonator)
- Specified by:
onSessionDestroy
in interfaceIImpersonationService
-
reloadImpersonatedUserRoles
public IUser reloadImpersonatedUserRoles(IUser impersonated, java.lang.String impersonatorId)
- Specified by:
reloadImpersonatedUserRoles
in interfaceIImpersonationService
-
applyRolesAndAuthorities
public IUser applyRolesAndAuthorities(IUser impersonated, java.lang.String impersonatorId, java.util.List<Case> configs)
- Specified by:
applyRolesAndAuthorities
in interfaceIImpersonationService
-
updateImpersonatedId
protected void updateImpersonatedId(LoggedUser loggedUser, java.lang.String id, java.util.List<Case> configs)
-
updateImpersonatedId
protected void updateImpersonatedId(LoggedUser loggedUser, java.lang.String id, java.util.List<Case> configs, java.time.LocalDateTime validUntil)
-
getConfigValidToTime
protected java.time.LocalDateTime getConfigValidToTime(Case config)
-
-