Skip to content

Commit

Permalink
feat: Add support for mutualTLS security handler
Browse files Browse the repository at this point in the history
fix lint errors
  • Loading branch information
john-macedo committed Jun 9, 2023
1 parent c1c5061 commit ada004b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/middleware/native/oas-security.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ export class OASSecurity extends OASBase {
case 'openIdConnect':
return [secName, await handlers[secName](secDef, secScope)];
case 'mutualTLS':
let cert = null;
if (req.socket instanceof TLSSocket)
cert = req.socket.getPeerCertificate(true);
// cert could be null or {} or a peer cert
return [secName, await handlers[secName](cert)];
{
let cert = null;
if (req.socket instanceof TLSSocket){
cert = req.socket.getPeerCertificate(true);
}
// cert could be null or {} or a peer cert
return [secName, await handlers[secName](cert)];
}
default:
throw new UnsupportedError(`Security scheme ${secName} is invalid or not supported.`);
}
Expand Down

0 comments on commit ada004b

Please sign in to comment.