ChangeCalendar/backend/src/main/java/com/nttdata/calender/WebMvcConfig.java

34 lines
1.2 KiB
Java

package com.nttdata.calender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.nttdata.calender.api.RequestInterceptor;
import com.nttdata.calender.api.rsso.RssoInterceptor;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
private final RssoInterceptor sessionInterceptor;
private final RequestInterceptor requestInterceptor;
@Autowired
public WebMvcConfig(RssoInterceptor sessionInterceptor, RequestInterceptor requestInterceptor) {
this.sessionInterceptor = sessionInterceptor;
this.requestInterceptor = requestInterceptor;
}
/**
* Adds the session interceptor and request interceptor to the interceptor registry.
*
* @param registry the interceptor registry.
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(sessionInterceptor).addPathPatterns("/**");
registry.addInterceptor(requestInterceptor).addPathPatterns("/**");
}
}