Spring-security: Spring WebFlux doesn't mix when Jackson mixins are applied

Created on 1 Aug 2018  路  5Comments  路  Source: spring-projects/spring-security

Origin: https://github.com/spring-projects/spring-session-data-mongodb/issues/33

Problem: Spring WebFlux + Spring Security + Spring Session MongoDB + JacksonMongoSessionConverter.

WebJackson2Module registers multiple mixins including CookieMixin. This fails because Cookie is not on the classpath.

Possible solution: Conditionalize some of these registrations so they are only done when Spring MVC on the classpath.

    public void setupModule(SetupContext context) {
        SecurityJackson2Modules.enableDefaultTyping((ObjectMapper)context.getOwner());
        context.setMixInAnnotations(Cookie.class, CookieMixin.class);
        context.setMixInAnnotations(SavedCookie.class, SavedCookieMixin.class);
        context.setMixInAnnotations(DefaultCsrfToken.class, DefaultCsrfTokenMixin.class);
        context.setMixInAnnotations(DefaultSavedRequest.class, DefaultSavedRequestMixin.class);
        context.setMixInAnnotations(WebAuthenticationDetails.class, WebAuthenticationDetailsMixin.class);
        context.setMixInAnnotations(PreAuthenticatedAuthenticationToken.class, PreAuthenticatedAuthenticationTokenMixin.class);
    }
web bug

All 5 comments

@rwinch Hello! Any updates regarding this issue?

@finke-ba Thanks for the ping. We haven't had a chance to work on this due to other issues. If you have a chance to provide a PR I'd be happy to work with you on getting it merged.

@rwinch Thanks for the reply and such a welcome invitation to collaboration. I will certainly make a pull request as soon as I can in the near future.

@rwinch Hello! I created a pull request #6293, could you please check and review it?

@rwinch just friendly remind you that we can close this issue as it fixed in #6302 and in #6303.

Was this page helpful?
0 / 5 - 0 ratings