users@glassfish.java.net

Re: Mutual Certificate Security

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 May 2010 00:42:31 PDT

Post webservices questions to metro forum for quick attention.

You can get the certificate using the following code :

@Resource
private WebserviceContext context;


      Subject clientSubject = null;
        try {
             clientSubject = SubjectAccessor.getRequesterSubject(context);
        } catch(Exception e) {
            e.printStackTrace();
        }
        if (clientSubject != null) {
            Set publicCreds = clientSubject.getPublicCredentials(
            for (Iterator it = publicCreds.iterator(); it.hasNext();) {
                System.out.println("Client Cert:" + it.next());
                //use our code to create the Certificate here.
                break;
            }
        } else {
            System.out.println("Client Cert not set");
        }
[Message sent by forum member 'kumarjayanti']

http://forums.java.net/jive/thread.jspa?messageID=470242