/**
 *
 */
package com.cusc.nirvana.user.rnr.fp.common;


import com.alibaba.fastjson.serializer.ValueFilter;
import com.cusc.nirvana.user.util.crypt.CryptKeyUtil;

public class FpIgnoreBase64ImgJsonSerializeFilter implements ValueFilter {

    @Override
    public Object process(Object object, String name, Object value) {
        // 过滤base64字段的输出
        if (FpLogOutputConstants.IGNORE_BASE64_FIELD_LIST.contains(name)) {
            return "ignore base64 string";
        }
        //隐私数据加密
        if (FpLogOutputConstants.ENCRYPTION_FIELD_LIST.contains(name)) {
            return value == null ? "" : CryptKeyUtil.encryptToBase64(value.toString());
        }

        return value;
    }
}
