Package ubic.gemma.core.util.test
Class TestAuthenticationUtilsImpl
- java.lang.Object
-
- ubic.gemma.core.util.test.TestAuthenticationUtilsImpl
-
- All Implemented Interfaces:
InitializingBean,TestAuthenticationUtils
@Service public class TestAuthenticationUtilsImpl extends Object implements InitializingBean, TestAuthenticationUtils
Utilities for manipulating theSecurityContextHolderin a test envirnoment.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description TestAuthenticationUtilsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidrunAsAdmin()Elevate to administrative privileges (tests normally run this way, this can be used to set it back if you called runAsUser).voidrunAsAgent()voidrunAsAnonymous()voidrunAsUser(String userName, boolean createIfMissing)Run as a regular user.
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
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:
runAsAdminin interfaceTestAuthenticationUtils
-
runAsAgent
public void runAsAgent()
- Specified by:
runAsAgentin interfaceTestAuthenticationUtils
-
runAsUser
public void runAsUser(String userName, boolean createIfMissing)
Run as a regular user.- Specified by:
runAsUserin interfaceTestAuthenticationUtils- Parameters:
userName- user namecreateIfMissing-
-
runAsAnonymous
public void runAsAnonymous()
- Specified by:
runAsAnonymousin interfaceTestAuthenticationUtils
-
-