title: Express SSL authentication functionality missing?
body: <p>I am trying to use SSL authentication with Express as discussed in <a href="http://intown.biz/2016/11/22/node-client-auth/" rel="nofollow noreferrer">http://intown.biz/2016/11/22/node-client-auth/</a>.</p>
  
  <p>We are using TypeScript for our server code (in addition to client Angular code) for the strong typing benefit.
  We are using Express 4.14.1, @types/express": "^4.0.36" </p>
  
  <p>The link above (as is the case with most server side NodeJS) is JavaScript not TypeScript. There is a chunk of code in the link that looks like the following:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.use(function (req, res, next) {
     if (!req.client.authorized) {
         return res.status(401).send('User is not authorized');
     }
     #examine the cert itself, and even validate based on that!
     var cert = req.socket.getPeerCertificate();
     if (cert.subject) {
         console.log(cert.subject.CN);
     }
     next();
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>The application discussed in the link works (he has a link to download the project).</p>
  
  <p>My problem: The latest types (4.0.36) don’t seem to have <strong>req.client</strong> or <strong>req.socket.getPeerCertificate()</strong>. They are not available in my TypeScript code (we do have Express imported/required). Also, I tried
  passing the TypeScript Request object into a plain JavaScript function and <strong>req.client</strong> and <strong>req.socket.getPeerCertificate()</strong> are still undefined. They just 
  aren't there.</p>
  
  <p>Note: We do have Passport initialized also. We are using that to authenticate our web application (client and internal REST API) but we have an 
  external/separate REST API that we wish to secure with SSL certificates. I doubt that having Passport plugged in would cause the the <strong>req.client</strong> and <strong>req.socket.getPeerCertificate()</strong> features to disappear?</p>
  
  <p>Can anyone tell me why I am not seeing req.client or req.socket.getPeerCertificate() in my Express code? Did they get replaced with something?</p>
  
  <p>Any help/ acknowledgements with this would be appreciated.</p>