-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client Certificate is not being picked up for authorization requests #802
Comments
No, Client certs are not send on openid authorization request. You define them to be used for the actual request. To use the certs, you have to add them on your own with interceptRequest. Is this a pattern which is used more often? I never seen client certs in an oauth2 call. |
Not sure if its common pattern to be honest - I can only tell that it is being used in my case. Will have a look at the interceptRequest - thx! |
I want to let this issue open. Small reminder for me to check how to implement Client certs requests in oauth2 flow |
putting this into the beginning of the http file works for me (when the client cert files are configured as per documentation): {{
exports.oauth2_interceptRequest = function(request, context) {
const clientCertificateOptions = context.config?.clientCertificates["your-domain"];
const fs = require('fs');
// Reading certificate and key files synchronously
const certificate = fs.readFileSync(clientCertificateOptions.cert, 'utf8');
const key = fs.readFileSync(clientCertificateOptions.key, 'utf8');
if (!request.options) {
request.options = {};
}
request.options.https = Object.assign({}, request.options.https, {
certificate: certificate,
key: key,
});
}
}} |
@eporsche You were faster. I would have implemented the same solution, except that I use the existing methods and therefore have less code. I would add mine anyway, as it makes sense to support it out of the box. And I'm impressed that you put the solution together so quickly. |
Hi,
what could be the reason httpyac is not picking up client certificates? I tried it with .httpyac.json in the root of the project and direclty setting the "(X-)ClientCert:" Header. It works with Postman though.
Could it be that the certificates are not being used during the openid requests?
The text was updated successfully, but these errors were encountered: