web.xml - javax.servlet.request.X509Certificate issue with returns null value -
when try run following code eclipse, return value null:
x509certificate cert[] = (x509certificate[]) request.getattribute("javax.servlet.request.x509certificate"); system.out.println("cert: " + cert[0]); //always returns null
could assist me issue? read somewhere saying have set client authentication value true, how do that? use pom.xml , web.xml (attached below)
web.xml: <security-constraint> <web-resource-collection> <web-resource-name>https<web-resource-name> <url-pattern>/*<url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> <login-config> <auth-method>client-cert</auth-method> </login-config> pom.xml: <groupid>org.codehaus.mojo</groupid> <artifactid>tomcat-maven-plugin</artifactid> <configuration> <httpsport>8443</httpsport> <keystorefile>${basedir}/certs/keystore.jks</keystorefile> <keystorepass>changeit</keystorepass> </configuration>
any appreciated!!
thanks!
client authentication false default. should able use property make true:
maven.tomcat.https.clientauth
you can find more here.
note property available in version 2.1 of plugin.
Comments
Post a Comment