the request.AuthType needs to be request.CLIENT_CERT_AUTH
if(request.getAuthType()==request.CLIENT_CERT_AUTH)
{
//do your cert processing...
}
so in web.xml
<login-config>
 <auth-method>CLIENT_CERT</auth_method>
 <realm-name>RealmName</realm-name>
</login-config>
so check the auth-method from your web.xml and make sure you set up to 

Standard Caveats apply as this is Only one solution amongst many

M-
This e-mail communication and any attachments may contain confidential and 
privileged information for the use of the 
designated recipients named above. If you are not the intended recipient, you 
are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its 
contents
----- Original Message ----- 
From: "Andrew Friebel" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Wednesday, November 08, 2006 7:36 PM
Subject: Extracting certificate information


>I wish to extract certificate information from my servlet that is
> running within tomcat.  The problem that I get is that my x509
> certificate array is always null.  The code snippet that I am attempting
> to use is:
> 
> X509Certificate[] certs = (X509Certificate[])
> request.getAttribute("javax.servlet.request.X509Certificate");
>                        
> if (certs == null) {
> // do non-ssl items
> } else {
>                        
> // Attempt to extract principal name from Subject:
>   String clientDN = certs[0].getSubjectDN().getName();
>   System.out.println("Client DN = " + clientDN);
> }
> 
> My understanding is that when I use the getAttribute as I have above, I
> am supposed to get an array of X509Certificate objects.  Instead, certs
> is always null.  The above code is in the doPost method of a servlet
> that has received data sent to it using SSL.
> 
> I am running tomcat 5.0.27 with java 1.4.2_06.
> 
> Any ideas?
> 
> 
> Regards,
> Andrew Friebel
> 
>

Reply via email to