Last active
June 22, 2017 08:41
-
-
Save willmorgan/b8aa412c917dac3ec6a811626d15f640 to your computer and use it in GitHub Desktop.
Azure Function crasher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sshpk = require('sshpk'); | |
function printClientCert(cert) { | |
return sshpk.parseCertificate(cert, 'x509'); | |
} | |
module.exports = function (context, req) { | |
context.log( | |
printClientCert(Buffer.from(req.headers['x-arr-clientcert'], 'base64')) | |
); | |
context.res = { | |
status: 200, | |
headers: { | |
'Content-Type': 'text/json', | |
}, | |
body: { | |
cert: printClientCert(Buffer.from(req.headers['x-arr-clientcert'], 'base64')), | |
}, | |
}; | |
context.done(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"disabled": false, | |
"bindings": [ | |
{ | |
"authLevel": "anonymous", | |
"type": "httpTrigger", | |
"direction": "in", | |
"route": "cert", | |
"name": "req" | |
}, | |
{ | |
"type": "http", | |
"direction": "out", | |
"name": "res" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "function.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "UNLICENSED", | |
"dependencies": { | |
"sshpk": "^1.13.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment