package dp.kotul.jwtapi.filter

import org.springframework.stereotype.Component
import javax.servlet.Filter
import javax.servlet.FilterChain
import javax.servlet.ServletRequest
import javax.servlet.ServletResponse
import javax.servlet.http.HttpServletResponse

@Component
class ResponseHeadersWebFilter : Filter {
    override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
        val httpServletResponse = response as HttpServletResponse
        httpServletResponse.setHeader("Cache-Control", "no-store")
        httpServletResponse.setHeader("Pragma", "no-cache")
        chain.doFilter(request, response)
    }
}
