I was trying out the following config code, to get different session management for two APIs based on ant matchers
http
.authorizeRequests().antMatchers("/apiV1/**").authenticated()
.and().sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
// How to add in details for custom session cookie for apiV1 ?
.and().authorizeRequests().antMatchers("/apiV2/**").authenticated()
.and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
// How to add in details for custom session cookie for apiV2 ?
.and().oauth2Login(Customizer.withDefaults());
I would also require to invalidate /apiV2
session after 3 minutes (configurable).
Also is it possible to maintain two different session cookie attributes (with custom names) for these two APIs and have code to invalidate them based on some business logic?