Class 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 Detail

      • AuthenticationUtil

        public AuthenticationUtil()
    • Method Detail

      • runAsSystem

        public <R> R runAsSystem​(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork<R> runAsWork)
        Helper method that executed work as system user.

        Useful when testing using mocks.

        See Also:
        AuthenticationUtil.runAsSystem(RunAsWork)
      • runAs

        public <R> R runAs​(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork<R> runAsWork,
                           String uid)
        Helper method that executed work as given user.

        Useful when testing using mocks.

        See Also:
        AuthenticationUtil.runAs(RunAsWork, String)
      • getFullyAuthenticatedUser

        public String getFullyAuthenticatedUser()
        Helper method that gets the fully authenticated user.

        Useful when testing using mocks.

        See Also:
        AuthenticationUtil.getFullyAuthenticatedUser()
      • 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()
        See Also:
        AuthenticationUtil.isRunAsUserTheSystemUser()