Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class SecurityContextHolder
- Object
- SecurityContextHolder
Who the calling thread’s request is from.
Authentication who = SecurityContextHolder.getContext().getAuthentication();The context belongs to the thread serving a request, for the length of that
request: the chain that guards the request fills it in, and the server
clears it when the request ends. It does not follow work handed to another
thread – an @Async method or a scheduled job starts with none.
Methods
public static SecurityContext getContext() | The thread’s context; an empty one is made when there is none. |
public static void setContext(SecurityContext context) | Replaces the thread’s context. |
public static void clearContext() | Forgets the thread’s context. |
public static SecurityContext createEmptyContext() | A context with no authentication in it. |
Inherited methods
Method details
getContext
public static SecurityContext getContext()The thread’s context; an empty one is made when there is none.
setContext
public static void setContext(SecurityContext context)Replaces the thread’s context.
clearContext
public static void clearContext()Forgets the thread’s context.
createEmptyContext
public static SecurityContext createEmptyContext()A context with no authentication in it.