views:

882

answers:

1

Hi,

I need to extract more information than just the CN of the certificate. Currently, I only get the standard UserDetails loadUserByUsername(String arg) where arg is the CN of the certificate. I need to get the X509Certificate object. Is it possible?

on spring security xml file :

<x509 subject-principal-regex="CN=(.*?),"  user-service-ref="myUserDetailsService" />
A: 

No you can't get it that way. You need to grab it from the HttpServletRequest:

X509Certificate[] certs = (X509Certificate[])HttpServletRequest.getAttribute("javax.servlet.request.X509Certificate");
Gandalf