Fix AuthenticationPrincipalArgumentResolver xml doc

Fixes gh-3771
This commit is contained in:
Joe Grandja 2016-04-15 17:06:17 -04:00 committed by Rob Winch
parent 337a7ed35e
commit 81c9fa805f
1 changed files with 5 additions and 2 deletions

View File

@ -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: