最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Spring Oauth2 with @EnableJdbcHttpSession serialization error - Stack Overflow

programmeradmin4浏览0评论

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}
}
}
发布评论

评论列表(0)

  1. 暂无评论