users@jsr311.java.net

Re: Getting client X509Certificate

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 08 Jun 2010 16:34:38 +0200

Hi Reto,

On Jun 8, 2010, at 12:53 PM, Reto Bachmann-Gmuer wrote:

> Hello,
>
> Is there a standard way (i.e. one that doesn't just work on servlet
> based implementations) to get client certificates (X509Certificate)
> in a jax-rs root resource?
>

There is nothing specific to JAX-RS to abstract from servlet, do you
want to log an issue?

Others on the list my find the following useful.

You can an inject the HttpServletRequest and then get the attributes:

http://java.sun.com/javaee/6/docs/api/javax/servlet/ServletRequest.html#getAttribute%28java.lang.String%29

as the JavaDoc states:

   "For example, for requests made using HTTPS, the attribute
javax.servlet.request.X509Certificate can be used to
    retrieve information on the certificate of the client."

(Henry, thanks for the hint)

Paul.