FIX: setAllowUserInteraction(true) Fails to Prompt Certificates


Instead of prompting the user for client-side certificates,
connection.setAllowUserInteraction(true); (where connection is a
URLConnection object) fails. This happens when the Web server is configured
so that it requests client certificates.


Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem has been fixed for the
Microsoft virtual machine build 3154 and greater.


Steps to Reproduce Behavior

  1. Setup a Web server with both HTTP and HTTPS support (for example, the
    Web server host name is "XYZ").
  2. Get a client certificate from a valid certificate authority.
  3. Configure the Web server so that it requests a client certificates,
    which enables some user interaction on the browser side.
  4. Write the following Java application,

    import*;import*;import java.applet.*;public class HttpGetClient extends Applet{   public static void main(String[] args)   {       HttpGet(args[0]);   }     public void init()     {       HttpGet(getParameter("URL"));     }     public static void HttpGet(String url_s)     {        try        {           URL url = new URL(url_s);           URLConnection connection = url.openConnection();           connection.setAllowUserInteraction(true);           connection.connect();           InputStream in = connection.getInputStream();           int   l = connection.getContentLength();           if (l < 0)           {            l = in.available();           }           System.out.println("Content-Length = " + l + "\r\n");           byte[]   buf = new byte[l]; ;           System.out.println();           System.out.println(new String(buf));        }        catch(Throwable e)        {           e.printStackTrace();        }     }   }
  5. Write the following HTML file, HttpGetClient.html:

    <html><head>   <title> Just testing SSL </title></head><body>      <hr>      <center>        <applet code=HttpGetClient.class width=200 height=280>        <param name=URL value=https://XYZ/HttpGetClient.html>        <h2> Just testing SSL </h2>        </applet>      </center>      <hr></body></html>
  6. Copy the and HttpGetClient.html files into the root
    directory of the Web server XYZ.
  7. Go to the following Web page (browse in a new process):
RESULT: The following error message appears: XYZ:443//HttpGetClient.html
The Java code calls setAllowUserInteraction(true). Therefore, the applet
should prompt the user with the client certificate instead of failing.


Please see Internet Client SDK for more information.

For the latest Knowledge Base articles and other support information on
Visual J++ and the SDK for Java, see the following pages on the Microsoft
Technical Support site:

(c) Microsoft Corporation <1998>, All Rights Reserved. Contributions by
Mohan Ananthakrishnan, Microsoft Corporation.

Id. de artículo: 197944 - Última revisión: 02/14/2017 - Revisión: 1