package com.backendsys.config.Kaptcha;

import com.backendsys.utils.CommonUtil;
import jakarta.servlet.http.HttpServletRequest;

public class KaptchaUtil {

    /**
     * 获得 ua + ip 的 Key (用于Redis-key)
     * @param request
     * @return
     */
    public static String getKaptchaKey(HttpServletRequest request){
        String ip = CommonUtil.getIpAddr(request);
        String userAgent = request.getHeader("User-Agent");
        String key = "captcha:ua:ip:" + CommonUtil.MD5(ip+userAgent);
        return key;
    }

}
