hunk.code_window:         </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
           </dependency>
           <dependency>
               <groupId>org.hibernate.validator</groupId>
               <artifactId>hibernate-validator</artifactId>
               <version>6.0.17.Final</version>
           </dependency>
  
hunk.labels: keep keep keep keep add keep keep keep keep keep
hunk.after_edit:         <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-data-redis</artifactId>
           </dependency>
           <dependency>
               <groupId>org.springframework.session</groupId>
               <artifactId>spring-session-data-redis</artifactId>
           </dependency>
  
hunk.file_path: app/server/appsmith-server/pom.xml
hunk.type: add
file: package com.appsmith.server.services;
  
  import com.appsmith.server.domains.User;
  import com.appsmith.server.repositories.UserRepository;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.security.core.Authentication;
  import org.springframework.security.core.context.ReactiveSecurityContextHolder;
  import org.springframework.security.core.context.SecurityContext;
  import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
  import org.springframework.stereotype.Service;
  import reactor.core.publisher.Mono;
  
  @Slf4j
  @Service
  public class SessionUserServiceImpl implements SessionUserService {
  
      private final UserRepository repository;
  
      public SessionUserServiceImpl(UserRepository userRepository) {
          this.repository = userRepository;
      }
  
      @Override
      public Mono<User> getCurrentUser() {
          return ReactiveSecurityContextHolder.getContext()
                  .map(SecurityContext::getAuthentication)
                  .map(Authentication::getPrincipal)
                  .flatMap(principal -> {
                      String email;
                      if (principal instanceof org.springframework.security.core.userdetails.User) {
                          org.springframework.security.core.userdetails.User user = (org.springframework.security.core.userdetails.User) principal;
                          //Assumption that the user has inputted an email as username during user creation and not english passport name
                          email = user.getUsername();
                      } else {
                          DefaultOidcUser defaultOidcUser = (DefaultOidcUser) principal;
                          email = defaultOidcUser.getEmail();
                      }
                      return repository.findByEmail(email);
                  });
      }
  }
  