<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624903#M153635</link>
    <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;
  &lt;P&gt;Thank you so much for your answer.&lt;/P&gt;
  &lt;P&gt;Yes I added the "cert" domain to my application and used the "cert" Url in my request.&lt;/P&gt;
  &lt;P&gt;I used the following command to deploy my application without a application.properties file. Is this file required and how can I set the vm arguments there?&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;neo deploy --host hana.ondemand.com --account &amp;lt;acc&amp;gt; --application &amp;lt;app&amp;gt; --user &amp;lt;user&amp;gt; --vm-arguments "-Dcom.sap.cloud.crypto.clientcert.mapping_mode=CN"&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I used a Custom CA (created by myself) to sign my client certificate. Maybe that is the problem? How can I use one of the above mentioned CAs (I am not an expert in certificates)?&lt;/P&gt;
  &lt;P&gt;I have configured a SAML IDP which I use for my applications hosted on SCP and it works fine. &lt;/P&gt;
  &lt;P&gt;But I have a scenario, where customers are calling my cloud services in their backend systems. In this scenario SAML is not possible as it is "machiene to machiene" communication. In this scenario I want to use client certificates for authentication. Or do you see a better way for doing that?&lt;/P&gt;
  &lt;P&gt;Best Regards,&lt;/P&gt;
  &lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2018 08:37:23 GMT</pubDate>
    <dc:creator>christoffer_fuss</dc:creator>
    <dc:date>2018-05-23T08:37:23Z</dc:date>
    <item>
      <title>SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaq-p/624901</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I want to protect one of my JAVA Servlets with Client Certificate Auhtentication:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt; String user = request.getRemoteUser();   
 //Authenticates the User
 if (user != null) {
    _Logger.info("User already authenticated");
 } 
 else {  
   //authenticate the User    
   LoginContext loginContext;
   try {
       loginContext = LoginContextFactory.createLoginContext("CERT");
       loginContext.login();
       //update the user
       user = request.getRemoteUser();
   } catch (LoginException e) {
      _Logger.error("Authentication failed: ", e);
       return;
   } 
 } 
     &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I created a certificate and signed it with my CA. I added the certificate to a keystore and uploaded it to SCP as described here:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;A href="https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/0d7cf63b75a94f869895186a2d38db41.html"&gt;&lt;/A&gt;&lt;A href="https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/0d7cf63b75a94f869895186a2d38db41.html" target="test_blank"&gt;https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/0d7cf63b75a94f869895186a2d38db41.html&lt;/A&gt;&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;In addition I added the domain cert.hana.ondemand.com to my java application.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;When I call my servlet, for example with the tool "SoapUi" or with JAVA HttpClient and send the Certificate I always geht the Loginexception:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;avax.security.auth.login.LoginException: Client certificate is not available in the request&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Has anybody an idea what is getting wrong?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Best Regards and Thanks in advance,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Chris&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:16:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaq-p/624901</guid>
      <dc:creator>christoffer_fuss</dc:creator>
      <dc:date>2018-05-16T10:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624902#M153634</link>
      <description>&lt;P&gt;Hi Christoffer,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;How are you accessing your application?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;This is the correct way of accessing your application, after you issue the neo command that adds the "cert" domain to it.:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://&amp;lt;app_name&amp;gt;&amp;lt;subaccount&amp;gt;.cert.hana.ondemand.com/&amp;lt;app-context&amp;gt;" target="test_blank"&gt;https://&amp;lt;app_name&amp;gt;&amp;lt;subaccount&amp;gt;.cert.hana.ondemand.com/&amp;lt;app-context&amp;gt;&lt;/A&gt;;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;instead of:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://&amp;lt;app_name&amp;gt;&amp;lt;subaccount&amp;gt;.hana.ondemand.com/&amp;lt;app-context&amp;gt;" target="test_blank"&gt;https://&amp;lt;app_name&amp;gt;&amp;lt;subaccount&amp;gt;.hana.ondemand.com/&amp;lt;app-context&amp;gt;&lt;/A&gt;;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I generated a war file and used the cockpit to deploy the app so I could specify the VM parameter as following:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;-Dcom.sap.cloud.crypto.clientcert.mapping_mode=CN&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;If you do not specify this during deployment, then your cert url will not work.&lt;/P&gt;
  &lt;P&gt;You could specify this VM parameter via neo deploy command, but your have to prepare the application.properties file beforehand.&lt;/P&gt;
  &lt;P&gt;Please be advised that if your are not using any of the CAs listed &lt;A href="https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/fe957070f9f7447cb886eb65e6a0543e.html"&gt;here&lt;/A&gt; that the client certificate will never be sent by the browser since it is not a certificate that is trusted by SCP. &lt;/P&gt;
  &lt;P&gt;If that's your case I suggest you check using SCP with your corporate IdP to authenticate your users using SAML. This setup will support the certificates issued by your internal CAs (since authentication is delegated to your IdP) and the authentication will be valid for all applications on SCP.&lt;/P&gt;
  &lt;P&gt;I have seen the following additional VM parameter:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;-Dcom.sap.cloud.crypto.clientcert.keystore_name=tomcat&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Where &amp;lt;tomcat&amp;gt; is the name of the jks file (i.e.: C:\tomcat.jks). I have tested this scenario, but it didn't quite work for me. I would've expected to see two client certificates, but only my SAP client certificate was presented by the browser. Which leads me into thinking that the keystore is not being taken into account.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Nonetheless, check which CAs are needed on this jks as they shouldn't be quite the same as the ones you use for testing locally. All you need are the root and intermediate certificates that have signed the p12 client certificate stored on your browser.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Hope it helps.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;BR /&gt;Ivan&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 13:33:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624902#M153634</guid>
      <dc:creator>Ivan-Mirisola</dc:creator>
      <dc:date>2018-05-22T13:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624903#M153635</link>
      <description>&lt;P&gt;Hi Ivan,&lt;/P&gt;
  &lt;P&gt;Thank you so much for your answer.&lt;/P&gt;
  &lt;P&gt;Yes I added the "cert" domain to my application and used the "cert" Url in my request.&lt;/P&gt;
  &lt;P&gt;I used the following command to deploy my application without a application.properties file. Is this file required and how can I set the vm arguments there?&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;neo deploy --host hana.ondemand.com --account &amp;lt;acc&amp;gt; --application &amp;lt;app&amp;gt; --user &amp;lt;user&amp;gt; --vm-arguments "-Dcom.sap.cloud.crypto.clientcert.mapping_mode=CN"&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I used a Custom CA (created by myself) to sign my client certificate. Maybe that is the problem? How can I use one of the above mentioned CAs (I am not an expert in certificates)?&lt;/P&gt;
  &lt;P&gt;I have configured a SAML IDP which I use for my applications hosted on SCP and it works fine. &lt;/P&gt;
  &lt;P&gt;But I have a scenario, where customers are calling my cloud services in their backend systems. In this scenario SAML is not possible as it is "machiene to machiene" communication. In this scenario I want to use client certificates for authentication. Or do you see a better way for doing that?&lt;/P&gt;
  &lt;P&gt;Best Regards,&lt;/P&gt;
  &lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 08:37:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624903#M153635</guid>
      <dc:creator>christoffer_fuss</dc:creator>
      <dc:date>2018-05-23T08:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624904#M153636</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I got the same scenario as yours, backend system connects to the cloud service. &lt;/P&gt;&lt;P&gt;Did you resolve this issue? I am very curiouse about your solution for this issue.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Alex.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 01:17:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624904#M153636</guid>
      <dc:creator>alex_zhu2</dc:creator>
      <dc:date>2018-11-05T01:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624905#M153637</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;I switched to "API Management Service". Here the client certificate authentication was working fine and the service was matching my requirements fine.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Chris &lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 07:35:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624905#M153637</guid>
      <dc:creator>christoffer_fuss</dc:creator>
      <dc:date>2018-11-05T07:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624906#M153638</link>
      <description>&lt;P&gt;Thank you Chris.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 02:16:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624906#M153638</guid>
      <dc:creator>alex_zhu2</dc:creator>
      <dc:date>2018-11-06T02:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud Platform JAVA Servlet: Client Certificate Authentication not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624907#M153639</link>
      <description>&lt;P&gt;maybe OAuth Client Credentials Flow is also a good way for machine to machine communication.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 19:37:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-platform-java-servlet-client-certificate-authentication-not/qaa-p/624907#M153639</guid>
      <dc:creator>a_wuttig</dc:creator>
      <dc:date>2020-03-24T19:37:08Z</dc:date>
    </item>
  </channel>
</rss>

