@AlfrescoPublicApi public class AuthenticationUtil extends Object implements org.springframework.beans.factory.InitializingBean
Modifier and Type | Class and Description |
---|---|
static interface |
AuthenticationUtil.RunAsWork<Result> |
Modifier and Type | Field and Description |
---|---|
static String |
SYSTEM_USER_NAME |
Constructor and Description |
---|
AuthenticationUtil() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
static void |
clearCurrentSecurityContext()
Remove the current security information
|
static String |
getAdminRoleName() |
static String |
getAdminUserName()
Get the name of the default admin user (the admin user created during bootstrap)
|
static net.sf.acegisecurity.Authentication |
getFullAuthentication()
WARN: Advanced usage only.
Get the authentication for that was set by an real authentication. |
static String |
getFullyAuthenticatedUser()
Get the fully authenticated user.
|
static String |
getGuestRoleName()
Get the name of the guest role
|
static String |
getGuestUserName()
Get the name of the Guest User
|
static net.sf.acegisecurity.Authentication |
getRunAsAuthentication()
Get the current authentication for application of permissions.
|
static String |
getRunAsUser()
Get the user that is currently in effect for purposes of authentication.
|
static String |
getSystemUserName()
Get the name of the system user
|
static org.alfresco.util.Pair<String,String> |
getUserTenant(String userName) |
static boolean |
isMtEnabled() |
static boolean |
isRunAsUserTheSystemUser() |
static void |
logAuthenticatedUsers()
Logs the current authenticated users
|
static void |
logNDC(String userNameIn) |
static void |
popAuthentication()
Pop the authentication context from a threadlocal stack.
|
static void |
pushAuthentication()
Push the current authentication context onto a threadlocal stack.
|
static <R> R |
runAs(AuthenticationUtil.RunAsWork<R> runAsWork,
String uid)
Execute a unit of work as a given user.
|
static <R> R |
runAsSystem(AuthenticationUtil.RunAsWork<R> runAsWork) |
static net.sf.acegisecurity.Authentication |
setAdminUserAsFullyAuthenticatedUser()
Authenticate as the Admin user.
|
void |
setDefaultAdminUserName(String defaultAdminUserName) |
void |
setDefaultGuestUserName(String defaultGuestUserName) |
static net.sf.acegisecurity.Authentication |
setFullAuthentication(net.sf.acegisecurity.Authentication authentication)
Re-authenticate using a previously-created authentication.
|
static net.sf.acegisecurity.Authentication |
setFullyAuthenticatedUser(String userName)
Authenticate as the given user.
|
static void |
setMtEnabled(boolean mtEnabled) |
static net.sf.acegisecurity.Authentication |
setRunAsUser(String userName)
WARN: Advanced usage only.
Switch to the given user for all authenticated operations. |
static net.sf.acegisecurity.Authentication |
setRunAsUserSystem()
WARN: Advanced usage only.
Set the system user as the currently running user for authentication purposes. |
public static final String SYSTEM_USER_NAME
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void setDefaultAdminUserName(String defaultAdminUserName)
public void setDefaultGuestUserName(String defaultGuestUserName)
public static void setMtEnabled(boolean mtEnabled)
public static boolean isMtEnabled()
public static net.sf.acegisecurity.Authentication setAdminUserAsFullyAuthenticatedUser()
public static net.sf.acegisecurity.Authentication setFullyAuthenticatedUser(String userName)
userName
- the user namepublic static net.sf.acegisecurity.Authentication setFullAuthentication(net.sf.acegisecurity.Authentication authentication)
public static net.sf.acegisecurity.Authentication setRunAsUserSystem()
setRunAsUser(String)
public static net.sf.acegisecurity.Authentication setRunAsUser(String userName)
getFullyAuthenticatedUser()
.userName
- the user to run aspublic static net.sf.acegisecurity.Authentication getRunAsAuthentication() throws AuthenticationException
setRunAsUser(String)
.AuthenticationException
public static net.sf.acegisecurity.Authentication getFullAuthentication() throws AuthenticationException
AuthenticationException
public static String getRunAsUser() throws AuthenticationException
runAs
.AuthenticationException
public static boolean isRunAsUserTheSystemUser()
public static String getFullyAuthenticatedUser() throws AuthenticationException
runAs
.AuthenticationException
public static String getSystemUserName()
public static String getAdminUserName()
public static String getAdminRoleName()
public static String getGuestUserName()
public static String getGuestRoleName()
public static void clearCurrentSecurityContext()
public static <R> R runAs(AuthenticationUtil.RunAsWork<R> runAsWork, String uid)
runAsWork
- the unit of work to douid
- the user IDpublic static <R> R runAsSystem(AuthenticationUtil.RunAsWork<R> runAsWork)
public static void pushAuthentication()
public static void popAuthentication()
public static void logAuthenticatedUsers()
public static void logNDC(String userNameIn)
Copyright © 2005–2017 Alfresco Software. All rights reserved.