1 package com.freemindcafe.apache.cxf.wsdl.sample3;
3 import java.security.cert.X509Certificate;
5 import javax.naming.InvalidNameException;
6 import javax.naming.ldap.LdapName;
7 import javax.naming.ldap.Rdn;
8 import javax.servlet.http.HttpServletRequest;
10 import org.
apache.cxf.binding.soap.SoapMessage;
11 import org.
apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;
13 import org.
apache.cxf.transport.http.AbstractHTTPDestination;
14 import org.
apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
18 public class SSLInterceptor
extends WSS4JInInterceptor{
20 public void handleMessage(SoapMessage message)
throws Fault {
21 System.out.println(
"SSLInterceptor-----------------");
23 HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
24 X509Certificate certs[] =
25 (X509Certificate[])request.getAttribute(
"javax.servlet.request.X509Certificate");
26 String dn = certs[0].getSubjectX500Principal().getName();
29 ldapDN =
new LdapName(dn);
30 for(Rdn rdn: ldapDN.getRdns()) {
31 System.out.println(rdn.getType() +
" -> " + rdn.getValue());
33 }
catch (InvalidNameException e) {