geoinfo_eGov_work/src/main/java/geoinfo/util/JwtUtil.java

58 lines
1.5 KiB
Java

package geoinfo.util;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.httpclient.NameValuePair;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
/**
* JWT 용 util class
* @author thkim
*
*/
public final class JwtUtil {
private static final Logger logger = LoggerFactory.getLogger(JwtUtil.class);
public static final String VERSION = "20251017_1430";
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
// 주석 다는 기준: https://www.oracle.com/technetwork/java/javase/tech/index-137868.html
/*
* 로그인 된 사용자의 cls값을 구한다.
*/
public static int getCls(HttpServletRequest request) {
if( request.getSession() != null ) {
return -1;
}
if( request.getSession().getAttribute("CLS") == null ) {
return -1;
}
return MyUtil.getIntegerFromObject(request.getSession().getAttribute("CLS"));
}
}