users@jersey.java.net

[Jersey] Re: Accessing X.509 attributes from filter

From: Samantha Berger <lambdadaku_at_gmail.com>
Date: Thu, 23 Jun 2011 13:12:10 -0700 (PDT)

Well, I have resolved it. In case you are interested:

An extra attribute has to be added in the filter class

             @Context
             HttpServletRequest httpRequest;

and fetching the x.509 by:

 
                Enumeration a = httpRequest.getAttributeNames();
                
                while (a.hasMoreElements()) {
                        String object = (String) a.nextElement();
                        logger.debug(object);
                        
                }
                X509Certificate[] certArr = (X509Certificate[])
               
httpRequest.getAttribute("javax.servlet.request.X509Certificate");
               
                //The first item in array is always the subject's
certificate
                logger.debug("user dn: "+certArr[0].getSubjectDN());



cheers,
Sam




--
View this message in context: http://jersey.576304.n2.nabble.com/Accessing-X-509-attributes-from-filter-tp6509732p6509852.html
Sent from the Jersey mailing list archive at Nabble.com.