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 the
SecurityContextHolder in a test envirnoment.- Author:
- poirigui
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidElevate to administrative privileges (tests normally run this way, this can be used to set it back if you called runAsUser).voidvoidvoidRun as a regular user.
-
Constructor Details
-
TestAuthenticationUtilsImpl
public TestAuthenticationUtilsImpl()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin 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:
runAsAdminin interfaceTestAuthenticationUtils
-
runAsAgent
public void runAsAgent()- Specified by:
runAsAgentin interfaceTestAuthenticationUtils
-
runAsUser
Run as a regular user.- Specified by:
runAsUserin interfaceTestAuthenticationUtils- Parameters:
userName- user namecreateIfMissing-
-
runAsAnonymous
public void runAsAnonymous()- Specified by:
runAsAnonymousin interfaceTestAuthenticationUtils
-