diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java index 8d51eeda437d..b53deaf57497 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/UserSignupCEImpl.java @@ -38,7 +38,6 @@ import org.springframework.util.StringUtils; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilterChain; -import org.springframework.web.server.WebSession; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -159,18 +158,16 @@ public Mono signupAndLogin(User user, ServerWebExchange exchange) { }); }); - return Mono.zip(createUserMono, exchange.getSession(), ReactiveSecurityContextHolder.getContext()) + return Mono.zip(createUserMono, ReactiveSecurityContextHolder.getContext()) .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.INTERNAL_SERVER_ERROR))) .flatMap(tuple -> { final User savedUser = tuple.getT1().getUser(); final String workspaceId = tuple.getT1().getDefaultWorkspaceId(); - final WebSession session = tuple.getT2(); - final SecurityContext securityContext = tuple.getT3(); + final SecurityContext securityContext = tuple.getT2(); Authentication authentication = new UsernamePasswordAuthenticationToken(savedUser, null, savedUser.getAuthorities()); securityContext.setAuthentication(authentication); - session.getAttributes().put(DEFAULT_SPRING_SECURITY_CONTEXT_ATTR_NAME, securityContext); final WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, EMPTY_WEB_FILTER_CHAIN); @@ -190,7 +187,13 @@ public Mono signupAndLogin(User user, ServerWebExchange exchange) { Mono authenticationSuccessMono = authenticationSuccessHandler .onAuthenticationSuccess( webFilterExchange, authentication, createApplication, true, workspaceId) - .thenReturn(1) + .then(exchange.getSession()) + .map(webSession -> { + webSession + .getAttributes() + .put(DEFAULT_SPRING_SECURITY_CONTEXT_ATTR_NAME, securityContext); + return 1; + }) .elapsed() .flatMap(pair -> { log.debug(