Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jinnyu opened this issue Aug 16, 2023 · 3 comments
Open

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

jinnyu opened this issue Aug 16, 2023 · 3 comments

Comments

@jinnyu
Copy link

jinnyu commented Aug 16, 2023

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

  • your apisix-java-plugin-runner version
    0.4.0
@yuluo-yx
Copy link

Can you post your filter logic?

@jinnyu
Copy link
Author

jinnyu commented Aug 24, 2023

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
Copy link

yuluo-yx commented Aug 24, 2023

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

@jinnyu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants