I am using Spring plain mvc(no springboot) OIDC based Oauth2 web app which authenticates using okta.
when I use @EnableJdbcHttpSession
v2.5.4 annotation I gets error spring won't find any converter from its core converter to convert java.lang.object to byte[] for OAuth2Authenitcation object to byte array to store in spring session attribute table.
I have exact similar configuration in separate project but with web.xml file with spring security filter chain of type .springFramework.web.filter.DelagatingFilterProxy
and seems to be working fine.
Note: I already have spring session and spring session table created and confirmed they works with other web app configuration.
following is my trimmed down version of files wondering if some one can help identify the issue.
@Configuration
@EnableWebSecurity
@EnableJdbcHttpSession
public class SecConfig{
protected void configure(HttpSecurity http){
http.sessionManagement()
..
oauth2Login()
..
authorizeRequests().anyRequest().hasAuthority("login")
}
}
@Bean
public ClientRegistrationRepository clientRegistration() {
// InMemoryClient RegistrationRepository gets create here
}
@Bean
public Logout successHandler(Client RegistrationRepository) {
}
}
Here is my SessionInitalizer to work with JdbcHttpSession
public class SessionInitializer extends AbsTractHttpSessionApplicationInitializer {
}
Here is my security analyzer
public class SecInitializer extends AbstractSecurityWebApplicationInitializer {
}
Here is my web app initializer b/c I don't have web.xml
public class WebAppInit extends AbstractWebAppInitializer {
@override
protected Class<?>[] getRootConfigClasses {
return new Class<?>[]{AppConfig.class}
}
@override getServletConfigClasses() {
return new Class<?>[]{WebConfig.class}
}
}