Describe the bug removeAuthorizationRequest method of HttpSessionOAuth2AuthorizationRequestRepository always return null which cause OAuth2AuthenticationException when using it with GenericJackson2JsonRedisSerializer

To Reproduce 1. Configure project included below dependencies

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.8'
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

sourceCompatibility = '11'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation('org.springframework.session:spring-session-data-redis') {
        exclude group: 'org.springframework.data', module: 'spring-data-redis'
    }
}
  1. Configure redis to use Generic2Jackson2JsonRedisSerializer so that session value can be stored as json format
  2. Try to authenticate through oauth2 protocol

Expected behavior It should be return appropriate request value no matter what format we use.

Sample Look around this Sample and don't forget to configure oauth2 properties with yours

Comment From: ilyako87

@Y-k-Y Hello, have you been able to solve this problem? I have a very similar problem, but with Spring Boot 3.

Comment From: Y-k-Y

@ilyako87 Unfortunately i couldn't solve this problem. I had to use the default serializer. If you encounter similar issue with mine then i guess it didn't fixed yet. Let me know if you solve your problem i also want to know how to solve this one as well.

Comment From: wylswz

I came across a similar issue today but it's nothing to do with serializer. I was debugging the application on a remote server with https disable. However the cookie was configured to be secure, thus not sent to the server, then it kept creating new sessions.

Comment From: sjohnr

Thanks for reaching out @Y-k-Y! Apologies that this issue was not responded to for a long time.

Thank you for providing a sample. It appears that you are not configuring the ObjectMapper for Redis per the documentation. I believe it would look like this (which works when I change your sample). I don't think you need the RedisTemplate @Bean in your sample to make Spring Session work.

Comment From: Y-k-Y

Thank you @sjohnr! Yes i can confirm that it resolves the issue. I should configure ObjectMapper for serializer not RedisTemplate.