Package org.apereo.cas.authentication
Class AuthenticationCredentialsThreadLocalBinder
- java.lang.Object
-
- org.apereo.cas.authentication.AuthenticationCredentialsThreadLocalBinder
-
public class AuthenticationCredentialsThreadLocalBinder extends java.lang.ObjectThreadLocal based holder for current set of credentials and/or authentication object for any current CAS authentication transaction. Useful for making this information available to all the interested CAS components that are not tightly coupled with core CAS APIs, for example audit principal resolver component, etc.The thread local state carried by this class should be set by core CAS components processing core authentication and CAS protocol events e.g.
AuthenticationManager,CentralAuthenticationService, etc.The clearing of this state at the end of a thread execution path is the responsibility of
AuthenticationCredentialsLocalBinderClearingFilter- Since:
- 5.0.0
-
-
Constructor Summary
Constructors Constructor Description AuthenticationCredentialsThreadLocalBinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbindCurrent(java.util.Collection<org.apereo.cas.authentication.Credential> credentials)Bind credentials to ThreadLocal.static voidbindCurrent(org.apereo.cas.authentication.Authentication authentication)Bind Authentication to ThreadLocal.static voidbindCurrent(org.apereo.cas.authentication.AuthenticationBuilder builder)Bind AuthenticationBuilder to ThreadLocal.static voidbindCurrent(org.apereo.cas.authentication.Credential... credentials)Bind credentials to ThreadLocal.static voidbindInProgress(org.apereo.cas.authentication.Authentication authentication)Bind Authentication to ThreadLocal for authentication event that has internally being processed and yet hasn't been fully established or selected by CAS to resume in later parts of the authentication flow, etc.static voidclear()Clear ThreadLocal state.static voidclearInProgressAuthentication()Clear ThreadLocal state.static org.apereo.cas.authentication.AuthenticationgetCurrentAuthentication()Get Authentication from ThreadLocal.static org.apereo.cas.authentication.AuthenticationBuildergetCurrentAuthenticationBuilder()Get AuthenticationBuilder from ThreadLocal.static java.lang.String[]getCurrentCredentialIds()Get credential ids from ThreadLocal.static java.lang.StringgetCurrentCredentialIdsAsString()Get credential ids String representation from ThreadLocal.static org.apereo.cas.authentication.AuthenticationgetInProgressAuthentication()Get Authentication from ThreadLocal.
-
-
-
Method Detail
-
bindInProgress
public static void bindInProgress(org.apereo.cas.authentication.Authentication authentication)
Bind Authentication to ThreadLocal for authentication event that has internally being processed and yet hasn't been fully established or selected by CAS to resume in later parts of the authentication flow, etc. This is typically used by the authentication manager to remember the current authentication object that is in the process of execution, carrying it to the next handler, etc if needed.- Parameters:
authentication- the authentication
-
bindCurrent
public static void bindCurrent(java.util.Collection<org.apereo.cas.authentication.Credential> credentials)
Bind credentials to ThreadLocal.- Parameters:
credentials- the credentials
-
bindCurrent
public static void bindCurrent(org.apereo.cas.authentication.Credential... credentials)
Bind credentials to ThreadLocal.- Parameters:
credentials- the credentials
-
bindCurrent
public static void bindCurrent(org.apereo.cas.authentication.Authentication authentication)
Bind Authentication to ThreadLocal.- Parameters:
authentication- the authentication
-
bindCurrent
public static void bindCurrent(org.apereo.cas.authentication.AuthenticationBuilder builder)
Bind AuthenticationBuilder to ThreadLocal.- Parameters:
builder- the authentication builder
-
getCurrentCredentialIds
public static java.lang.String[] getCurrentCredentialIds()
Get credential ids from ThreadLocal.- Returns:
- credential ids
-
getCurrentCredentialIdsAsString
public static java.lang.String getCurrentCredentialIdsAsString()
Get credential ids String representation from ThreadLocal.- Returns:
- credential ids String representation
-
getCurrentAuthenticationBuilder
public static org.apereo.cas.authentication.AuthenticationBuilder getCurrentAuthenticationBuilder()
Get AuthenticationBuilder from ThreadLocal.- Returns:
- authentication builder
-
getCurrentAuthentication
public static org.apereo.cas.authentication.Authentication getCurrentAuthentication()
Get Authentication from ThreadLocal.- Returns:
- authentication
-
getInProgressAuthentication
public static org.apereo.cas.authentication.Authentication getInProgressAuthentication()
Get Authentication from ThreadLocal.- Returns:
- authentication
-
clearInProgressAuthentication
public static void clearInProgressAuthentication()
Clear ThreadLocal state.
-
clear
public static void clear()
Clear ThreadLocal state.
-
-