@AlfrescoPublicApi
public class AuthenticationUtil
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean
Modifier and Type | Class and Description |
---|---|
static interface |
AuthenticationUtil.RunAsWork |
Modifier and Type | Field and Description |
---|---|
static java.lang.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 java.lang.String |
getAdminRoleName() |
static java.lang.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 java.lang.String |
getFullyAuthenticatedUser()
Get the fully authenticated user.
|
static java.lang.String |
getGuestRoleName()
Get the name of the guest role
|
static java.lang.String |
getGuestUserName()
Get the name of the Guest User
|
static net.sf.acegisecurity.Authentication |
getRunAsAuthentication()
Get the current authentication for application of permissions.
|
static java.lang.String |
getRunAsUser()
Get the user that is currently in effect for purposes of authentication.
|
static java.lang.String |
getSystemUserName()
Get the name of the system user
|
static org.alfresco.util.Pair |
getUserTenant(java.lang.String userName) |
static boolean |
isMtEnabled() |
static boolean |
isRunAsUserTheSystemUser() |
static void |
logAuthenticatedUsers()
Logs the current authenticated users
|
static void |
logNDC(java.lang.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 java.lang.Object |
runAs(AuthenticationUtil.RunAsWork runAsWork,
java.lang.String uid)
Execute a unit of work as a given user.
|
static java.lang.Object |
runAsSystem(AuthenticationUtil.RunAsWork runAsWork) |
static net.sf.acegisecurity.Authentication |
setAdminUserAsFullyAuthenticatedUser()
Authenticate as the Admin user.
|
void |
setDefaultAdminUserName(java.lang.String defaultAdminUserName) |
void |
setDefaultGuestUserName(java.lang.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(java.lang.String userName)
Authenticate as the given user.
|
static void |
setMtEnabled(boolean mtEnabled) |
static net.sf.acegisecurity.Authentication |
setRunAsUser(java.lang.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 java.lang.String SYSTEM_USER_NAME
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void setDefaultAdminUserName(java.lang.String defaultAdminUserName)
public void setDefaultGuestUserName(java.lang.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(java.lang.String userName)
userName
- the user namepublic static net.sf.acegisecurity.Authentication setFullAuthentication(net.sf.acegisecurity.Authentication authentication)
public static net.sf.acegisecurity.Authentication setRunAsUserSystem()
AuthenticationUtil.setRunAsUser(String)
public static net.sf.acegisecurity.Authentication setRunAsUser(java.lang.String userName)
#getAuthenticatedUser()
.userName
- the user to run aspublic static net.sf.acegisecurity.Authentication getRunAsAuthentication() throws AuthenticationException
AuthenticationUtil.setRunAsUser(String)
.AuthenticationException
public static net.sf.acegisecurity.Authentication getFullAuthentication() throws AuthenticationException
AuthenticationException
public static java.lang.String getRunAsUser() throws AuthenticationException
runAs
.AuthenticationException
public static boolean isRunAsUserTheSystemUser()
public static java.lang.String getFullyAuthenticatedUser() throws AuthenticationException
runAs
.AuthenticationException
public static java.lang.String getSystemUserName()
public static java.lang.String getAdminUserName()
public static java.lang.String getAdminRoleName()
public static java.lang.String getGuestUserName()
public static java.lang.String getGuestRoleName()
public static void clearCurrentSecurityContext()
public static java.lang.Object runAs(AuthenticationUtil.RunAsWork runAsWork, java.lang.String uid)
runAsWork
- the unit of work to douid
- the user IDpublic static java.lang.Object runAsSystem(AuthenticationUtil.RunAsWork runAsWork)
public static void pushAuthentication()
public static void popAuthentication()
public static void logAuthenticatedUsers()
public static void logNDC(java.lang.String userNameIn)
public static org.alfresco.util.Pair getUserTenant(java.lang.String userName)
Copyright © 2005 - 2013 Alfresco Software, Inc. All Rights Reserved.