Spring-security: SEC-2997: @AuthenticationPrincipal Optional<UserDetails> principal

Created on 5 Jun 2015  路  1Comment  路  Source: spring-projects/spring-security

Christopher Smith (Migrated from SEC-2997) said:

Most parameter bindings now support Optional, but @AuthenticationPrincipal doesn't. This causes some difficulties when trying to MockMvc-test controllers that use optional authentication, since my UserDetails doesn't have a default constructor and thus spinning up the entire Spring Security context is necessary just to get null passed to the method. Supporting Optional, which would let the MVC mapper supply the "null" on its own, would eliminate the need.

Currently, trying to use Optional with @AuthenticationPrincipal results in a _null_ Optional.

enhancement jira

Most helpful comment

any plans for this?

>All comments

any plans for this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mstoecklmayr picture mstoecklmayr  路  3Comments

adolfoweloy picture adolfoweloy  路  3Comments

jgrandja picture jgrandja  路  4Comments

heruan picture heruan  路  3Comments

aotrzonsek picture aotrzonsek  路  3Comments