Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was just reseaching solution to above problem and finally found a solution:</p> <ol> <li><p>Configure tomcat with connector clientAuth="false" attribute(Otherwise all secure connections to server will do mutual, client server, ssl authentification.</p></li> <li><p>Add the following in web.xml(I have just shown here example) </p> <pre><code>&lt;security-constraint&gt; &lt;web-resource-collection&gt; &lt;url-pattern&gt;/LoginTestServlet1&lt;/url-pattern&gt; &lt;http-method&gt;GET&lt;/http-method&gt; &lt;http-method&gt;POST&lt;/http-method&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;role-name&gt;manager&lt;/role-name&gt; &lt;/auth-constraint&gt; &lt;user-data-constraint&gt; &lt;!-- transport-guarantee can be CONFIDENTIAL, INTEGRAL, or NONE --&gt; &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt; &lt;/user-data-constraint&gt; &lt;/security-constraint&gt; &lt;security-constraint&gt; &lt;web-resource-collection&gt; &lt;url-pattern&gt;/LoginTestServlet2&lt;/url-pattern&gt; &lt;http-method&gt;GET&lt;/http-method&gt; &lt;http-method&gt;POST&lt;/http-method&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;role-name&gt;manager&lt;/role-name&gt; &lt;/auth-constraint&gt; &lt;!-- &lt;user-data-constraint&gt; transport-guarantee can be CONFIDENTIAL, INTEGRAL, or NONE &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt; &lt;/user-data-constraint&gt; --&gt; &lt;/security-constraint&gt; &lt;login-config&gt; &lt;auth-method&gt;CLIENT-CERT&lt;/auth-method&gt; &lt;realm-name&gt;certificate&lt;/realm-name&gt; &lt;/login-config&gt; </code></pre> <p> manager </p></li> <li><p>In tomcat users-users.xml add the following(pls note that if trust store has almost identical certificates then you should clearly identify your certificate as follows) </p> <pre><code>&lt;role rolename="manager"/&gt; </code></pre> <p>&lt; user username="EMAILADDRESS=hamzas100@yahoo.com, CN=KS, OU=OFF, O=OFS, L=Bukhara,<br> ST=Bukhara, C=UZ" password="" roles="manager"/></p></li> <li><p>put in a browser(or curl) address line: </p> <p><a href="https://yourdomain.com:8443/LoginTest/LoginTestServlet1" rel="nofollow">https://yourdomain.com:8443/LoginTest/LoginTestServlet1</a> or<br> <a href="https://yourdomain.com:8443/LoginTest/LoginTestServlet2" rel="nofollow">https://yourdomain.com:8443/LoginTest/LoginTestServlet2</a></p></li> <li><p>For this to work you have to add certificate to browser personal certificate list(if you are testing with browser). I have tried with Mozilla Firefox and it will easyly let you do this.(But it only accepts b12 certificate so it is suggested that you should use openssl with java keytool). If everything configured right then you will get prompt from mozilla to choose certificate from existing ones. If you are using curl(it is used for automatic web interfaces testing then use the following commant line to test(I have just given an example here.) Plese note that you should choose certificate which you imported into trust store.</p> <p>curl -s -k --cert selfsigned.pem --key key.pem -v --anyauth <a href="https://yourdomain.com:8443/LoginTest/LoginTestServlet1" rel="nofollow">https://yourdomain.com:8443/LoginTest/LoginTestServlet1</a> --cacert selfsigned.pem or curl -s -k --cert selfsigned.pem --key key.pem -v --anyauth <a href="http://yourdomain.com:8080/LoginTest/LoginTestServlet2" rel="nofollow">http://yourdomain.com:8080/LoginTest/LoginTestServlet2</a> --cacert selfsigned.pem </p></li> </ol> <p>Note: My connector looks like as follows:</p> <pre><code>&lt;Connector port="8443" maxThreads="150" scheme="https" secure="true" SSLEnabled="true" sslProtocol="TLS" keystoreType="PKCS12" truststoreType="PKCS12" clientAuth="false" keystoreFile="C:/Program Files/glassfish-3.1.2/glassfish/domains/domain1/config/cacerts.pkcs12" truststoreFile= "C:/Program Files/glassfish-3.1.2/glassfish/domains/domain1/config/cacerts.pkcs12" truststorePass="changeit" keystorePass="changeit" protocol="org.apache.coyote.http11.Http11Protocol"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload