You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Servlet API access, use `HttpServletRequest#getRemoteUser`.
101
105
102
106
By default, `SecurityContextHolder` uses a `ThreadLocal` to store these details, which means that the `SecurityContext` is always available to methods in the same thread, even if the `SecurityContext` is not explicitly passed around as an argument to those methods.
103
107
Using a `ThreadLocal` in this way is quite safe if you take care to clear the thread after the present principal's request is processed.
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/servlet/integrations/mvc.adoc
+66Lines changed: 66 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -448,6 +448,72 @@ open fun findMessagesForUser(@CurrentUser("user_id") userId: String?): ModelAndV
448
448
----
449
449
======
450
450
451
+
[[mvc-current-security-context]]
452
+
== @CurrentSecurityContext
453
+
454
+
Spring Security provides `CurrentSecurityContextArgumentResolver`, which can automatically resolve the current `SecurityContext` for Spring MVC arguments.
455
+
By using `@EnableWebSecurity`, you automatically have this added to your Spring MVC configuration.
456
+
If you use XML-based configuration, you must add this yourself:
0 commit comments