Package ubic.gemma.core.util.test
Class TestAuthenticationUtilsImpl
- java.lang.Object
-
- ubic.gemma.core.util.test.TestAuthenticationUtilsImpl
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,TestAuthenticationUtils
@Service public class TestAuthenticationUtilsImpl extends Object implements org.springframework.beans.factory.InitializingBean, TestAuthenticationUtils
Utilities for manipulating theSecurityContextHolder
in a test envirnoment.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description TestAuthenticationUtilsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
void
runAsAdmin()
Elevate to administrative privileges (tests normally run this way, this can be used to set it back if you called runAsUser).void
runAsAgent()
void
runAsAnonymous()
void
runAsUser(String userName, boolean createIfMissing)
Run as a regular user.
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
runAsAdmin
public void runAsAdmin()
Elevate to administrative privileges (tests normally run this way, this can be used to set it back if you called runAsUser). This gets called before each test, no need to run it yourself otherwise.- Specified by:
runAsAdmin
in interfaceTestAuthenticationUtils
-
runAsAgent
public void runAsAgent()
- Specified by:
runAsAgent
in interfaceTestAuthenticationUtils
-
runAsUser
public void runAsUser(String userName, boolean createIfMissing)
Run as a regular user.- Specified by:
runAsUser
in interfaceTestAuthenticationUtils
- Parameters:
userName
- user namecreateIfMissing
-
-
runAsAnonymous
public void runAsAnonymous()
- Specified by:
runAsAnonymous
in interfaceTestAuthenticationUtils
-
-