|
@@ -6576,10 +6576,13 @@ Spring Security provides `AuthenticationPrincipalArgumentResolver` which can aut
|
|
|
|
|
|
[source,xml]
|
|
|
----
|
|
|
-<bean class="org.springframework.security.web.method.annotation.AuthenticationPrincipalArgumentResolver" />
|
|
|
+<mvc:annotation-driven>
|
|
|
+ <mvc:argument-resolvers>
|
|
|
+ <bean class="org.springframework.security.web.method.annotation.AuthenticationPrincipalArgumentResolver" />
|
|
|
+ </mvc:argument-resolvers>
|
|
|
+</mvc:annotation-driven>
|
|
|
----
|
|
|
|
|
|
-
|
|
|
Once `AuthenticationPrincipalArgumentResolver` is properly configured, you can be entirely decoupled from Spring Security in your Spring MVC layer.
|
|
|
|
|
|
Consider a situation where a custom `UserDetailsService` that returns an `Object` that implements `UserDetails` and your own `CustomUser` `Object`. The `CustomUser` of the currently authenticated user could be accessed using the following code:
|