jrialland / ajp-client

Java implementation of an AJP13 protocol client (aka Apache JServ), allowing to send requests to a servlet container using this protocol.
Apache License 2.0
30 stars 7 forks source link

Non-string request attributes support #18

Closed avmusa closed 2 years ago

avmusa commented 3 years ago

Class com.github.jrialland.ajpclient.Attribute accepts values of String type (Strings list):

private AttributeType type;
private List<String> value;

In case I need to pass other type of the attribute, I get 500 error from the AJP endpoint (embedded tomcat in my case). For example, I need to send request attribute javax.servlet.request.X509Certificate of type java.security.cert.X509Certificate[] to perform TLS authentication on the backend.

I tried to serialize above array to byte array and wrap it to a String but it did not work.

jrialland commented 2 years ago

Unfortunately The ajp13 protocol "spec" states that attributes can only be strings (see https://tomcat.apache.org/connectors-doc-archive/jk2/common/AJPv13.html#Request%20Packet%20Structure ), and I haven't found any documentation regarding the way x509 certs have to be serialized.