Class AuthenticationUtil
- java.lang.Object
-
- org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil
-
public class AuthenticationUtil extends Object
Helper bean to allow injection of AuthenticationUtil methods.Useful when testing using mocks.
- Since:
- 2.3
- Author:
- Roy Wetherall
-
-
Constructor Summary
Constructors Constructor Description AuthenticationUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAdminUserName()
Helper method that gets the admin user name.String
getFullyAuthenticatedUser()
Helper method that gets the fully authenticated user.String
getGuestUserName()
Helper method that gets the guest user name.String
getRunAsUser()
Helper method to get the user that is currently in effect for purposes of authentication.String
getSystemUserName()
Helper method that gets the system user name.boolean
isRunAsUserTheSystemUser()
<R> R
runAs(AuthenticationUtil.RunAsWork<R> runAsWork, String uid)
Helper method that executed work as given user.<R> R
runAsSystem(AuthenticationUtil.RunAsWork<R> runAsWork)
Helper method that executed work as system user.
-
-
-
Method Detail
-
runAsSystem
public <R> R runAsSystem(AuthenticationUtil.RunAsWork<R> runAsWork)
Helper method that executed work as system user.Useful when testing using mocks.
-
runAs
public <R> R runAs(AuthenticationUtil.RunAsWork<R> runAsWork, String uid)
Helper method that executed work as given user.Useful when testing using mocks.
-
getFullyAuthenticatedUser
public String getFullyAuthenticatedUser()
Helper method that gets the fully authenticated user.Useful when testing using mocks.
-
getAdminUserName
public String getAdminUserName()
Helper method that gets the admin user name.Useful when testing using mocks.
- See Also:
AuthenticationUtil.getAdminUserName()
-
getSystemUserName
public String getSystemUserName()
Helper method that gets the system user name.- See Also:
AuthenticationUtil.getSystemUserName()
-
getGuestUserName
public String getGuestUserName()
Helper method that gets the guest user name.- See Also:
AuthenticationUtil.getGuestUserName()
-
isRunAsUserTheSystemUser
public boolean isRunAsUserTheSystemUser()
-
getRunAsUser
public String getRunAsUser() throws AuthenticationException
Helper method to get the user that is currently in effect for purposes of authentication. This includes any overlays introduced byrunAs(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork<R>, java.lang.String)
.- Returns:
- Returns the name of the user
- Throws:
AuthenticationException
-
-