//package kr.co.uplus.ez.common.jwt;
//
//import javax.servlet.http.Cookie;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.beans.factory.annotation.Autowired;
//
//import io.jsonwebtoken.Claims;
//import io.jsonwebtoken.ExpiredJwtException;
//import io.jsonwebtoken.JwtException;
//
//public class JwtAuthCookieFilter extends  JwtAuthFilter {
//	@Autowired
//	private JwtService jwtSvc;
//
//
//	public JwtAuthCookieFilter(JwtProperties jwtProps) {
//		super(jwtProps);
//	}
//
//	@Override
//	public String getToken(HttpServletRequest request) {
////		String payload = null, signature = null;
////		Cookie[] cookies = request.getCookies();
////		if (cookies != null) {
////			for (Cookie cookie : cookies) {
////				// 1. 쿠키에서 jwt 토큰 header.paload 부분 읽기
////				if (jwtProps.getPart1().equals(cookie.getName())) {
////					payload = cookie.getValue();
////				}
////				// 2. 쿠키에서 jwt 토큰 signature 부분 읽기
////				else if (jwtProps.getPart2().equals(cookie.getName())) {
////					signature = cookie.getValue();
////				}
////			}
////		}
////		if (cookies == null || payload == null || signature == null) {
////			return null;
////		}
////		String token = payload + "." + signature;
////		return token;
//		// 1. get jwtToken 
//		String header = request.getHeader(jwtProps.getHeader().toLowerCase());
//		// 2. 헤더 값 검사
//		if(header == null || !header.startsWith(jwtProps.getPrefix())) {
//			return null;
//		}
//		
//		// 3. Authorization 헤더에서 토큰 추출
//		return header.replace(jwtProps.getPrefix(), "");
//	}
//
//	@Override
//	public void onValidateSuccess(HttpServletRequest request, HttpServletResponse response, Claims claims) {
//		// 토큰 업데이트 - Sliding  Sessions
//		jwtSvc.updatePrivateToken(response, claims);
//	}
//
//	@Override
//	public void onValidateException(HttpServletRequest request, HttpServletResponse response, JwtException exception) {
//		if (exception instanceof ExpiredJwtException) {
//			jwtSvc.destroyPrivateToken(request, response);
//		}
//	}
//
//}