apache / apisix-java-plugin-runner

APISIX Plugin Runner in Java
https://apisix.apache.org/
Apache License 2.0
126 stars 95 forks source link

request help: Does java runner plugin going to be deprecated? #261

Open jinnyu opened 11 months ago

jinnyu commented 11 months ago

Issue description

I used the java runner plugin to perform pre authentication, but now the HttpRequest object does not have the header values pass throuth.

Environment

running in k8s APISIX v3.4.1-centos plugin runner : 0.4.0

yuluo-yx commented 11 months ago

Can you post your filter logic?

jinnyu commented 11 months ago

Can you post your filter logic?

    @Override
    public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
        // 这里取到的值为 null
        String authorization = request.getHeader(ConstHttp.HEADER_AUTHORIZATION);
        // 验证token
        ApisixAuthResult result = helper.verifyToken(authorization);
        if (result.isSuccess()) {
            chain.filter(request, response);
        } else {
            log.warn(result.getMsg());
            response.setStatusCode(401);
            response.setHeader("Content-Type", "application/json");
            response.setBody("{\"code\":\"A01101\",\"msg\":\"身份验证失败\",\"data\": null}");
        }
    }
yuluo-yx commented 11 months ago

It seems that your problem is similar to this #254 , you can wait for this problem to be resolved and try again.

@jinnyu