yinjihuan / monkey-api-encrypt

monkey-api-encrypt是对基于Servlet的Web框架API请求进行统一加解密操作
Apache License 2.0
792 stars 347 forks source link

不支持 /encryptEntity/{parm} #69

Open liufeikl2008 opened 3 years ago

liufeikl2008 commented 3 years ago

不支持 /encryptEntity/{parm} 这种方式的加解密啊

yinjihuan commented 3 years ago

有的 https://mp.weixin.qq.com/s/TbTr44Hc9gkJB40L9eHHYQ

human-user commented 3 years ago

有的 https://mp.weixin.qq.com/s/TbTr44Hc9gkJB40L9eHHYQ

似乎这里指的是加密filter的匹配模式不支持/encryptEntity/{parm}这种路径变量,例如post:/encryptEntity/abc,contains()方法无法匹配到list中对应的post:/encryptEntity/{parm},会返回false

    private boolean contains(List<String> list, String uri, String methodType) {
        if (list.contains(uri)) {
            return true;
        }
        String prefixUri = methodType.toLowerCase() + ":" + uri;
        logger.debug("contains uri: {}", prefixUri);
        if (list.contains(prefixUri)) {
            return true;
        }
        return false;
    }
gewei123456 commented 3 years ago

请问一下@Encrypt用在get请求/aaims/apply/api/v1/applyDetial/{dataId}也就是类似于这种类型的方法上,return的数据,在swagger上测试返回的为什么还是明文,POST请求用了@Encrypt和@Decrypt都没问题,swagger测试,入参出参都正常是密文,配置用的是引入POM依赖,启动类上加的@EnableEncrypt自动注解,yml文件里就配置了key和debug参数,项目是属于springboot类型的

yinjihuan commented 3 years ago

@human-user 目前是不支持的,后面我想下看怎么能支持

yinjihuan commented 3 years ago

@gewei123456 debug=true吗?开启debug模式就不会进行加解密

gewei123456 commented 3 years ago

开启自动注解后,不配置任何东西,swagger页面是加密不能测试的,所有的controller方法都自动加解密了,我之前那个情况是在开启自动注解后,在controller又加了一个@Encrypt注解,但是swagger又能测试了,然后post方法加解密正常,get方法返回不加密,总体来说是这种情况,debug: false一直是这个,yml文件就加了个key和debug,其他没加

------------------ 原始邮件 ------------------ 发件人: "yinjihuan/monkey-api-encrypt" @.>; 发送时间: 2021年3月23日(星期二) 上午9:32 @.>; @.**@.>; 主题: Re: [yinjihuan/monkey-api-encrypt] 不支持 /encryptEntity/{parm} (#69)

@gewei123456 debug=true吗?开启debug模式就不会进行加解密

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

human-user commented 3 years ago

@yinjihuan 使用Spring Boot自带的AntPathMatcher能很好处理

yinjihuan commented 3 years ago

@human-user https://github.com/yinjihuan/monkey-api-encrypt/releases/tag/v1.2.2.RELEASE 已支持