Skip to content

Support extensions of WebAuthenticationDetails when using Jackson serialization #10564

@danwashusen

Description

@danwashusen

Expected Behavior

Allow custom extensions of WebAuthenticationDetails to be deserialized by Jackson.

Current Behavior

The current public constructor on WebAuthenticationDetails expects a HttpServletRequest, which is not available at the time of deserialization.

Context

We use a custom extension of WebAuthenticationDetails (e.g. ExWebAuthenticationDetails) along with a custom AbstractUserDetailsAuthenticationProvider to set it up. This all works great, except we are unable to deserialize ExWebAuthenticationDetails using Jackson because the only accessible constructor expects a HttpServletRequest.

It seems like this has been considered because WebAuthenticationDetails has a private constructor specifically for Jackson, but we can't use it because it's private:

private WebAuthenticationDetails(final String remoteAddress, final String sessionId) {

At the moment our options are to create a mock implementing of HttpServletRequest that satisfies the constructor usage, or alternativaly copy the entire WebAuthenticationDetails class into our codebase... :/

Thanks!

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions