Package io.micronaut.security.context
Class SecurityContextHolder
java.lang.Object
io.micronaut.security.context.SecurityContextHolder
Access point for the
SecurityContext associated with the current server request.
The returned context is backed by request attributes populated by the security filter.
- Since:
- 4.18.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears the security context associated with the current request.static @NonNull SecurityContextReturns aSecurityContextfor the current request.
-
Method Details
-
getSecurityContext
Returns aSecurityContextfor the current request.- Returns:
- a
SecurityContextbacked by the current request, or an empty context if no request is active
-
clearContext
public static void clearContext()Clears the security context associated with the current request.
-