Skip to content
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

Support for 2 Factor Auth for WebDAV (passing certificate + passphrase)? #49

Closed
Jakobud opened this issue Nov 1, 2016 · 3 comments
Closed

Comments

@Jakobud
Copy link

Jakobud commented Nov 1, 2016

I was looking at #43 but I'm not sure if this is related or not. I was wondering if its possible to specify an SSL certificate and it's passphrase when making a curl connection to a WebDAV server.

If you look at this article:

http://www.qed42.com/blog/using-curl-webdav-two-factor-authentication

It shows exactly how to do this on the command line. I just tested this on OSX and it worked perfectly. You specify an SSL certificate and it's keyphrase/passphrase along with the typical username/password when making the connection.

Is the same thing is possible with this library? Can you pass the cert and passphrase as curl options or something?

@chriso
Copy link
Contributor

chriso commented Nov 1, 2016

This library is just a thin wrapper around the command line interface. Any options you pass to the library are passed directly to curl (along with some defaults).

You can see the command that was executed by inspecting the third argument:

> var curl = require('curlrequest')
undefined
> curl.request({ url: 'http://httpbin.org/get' }, function (err, response, meta) { 
... console.log(meta);
... });
undefined
> { cmd: 'curl',
  args: 
   [ '--silent',
     '--show-error',
     '--no-buffer',
     '--globoff',
     '--url',
     'http://httpbin.org/get',
     '--location',
     '--max-redirs',
     3,
     '--header',
     'Accept: */*',
     '--header',
     'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3',
     '--header',
     'Accept-Language: en-US,en;q=0.8',
     '--user-agent',
     'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6' ],
  time: 1013 }

I'm not sure about the options required to support your specific use-case, but you should be able to play around with library options until you get it right.

@chriso chriso closed this as completed Nov 1, 2016
@Jakobud
Copy link
Author

Jakobud commented Nov 1, 2016

Okay thanks I will mess around with it. So when I specify an option, like the --cert option do I just do:

var options = {
  "url": "https://www.google.com",
  "cert": "mycert.p12:mypassphrase"
};

Like that? Just take whatever the cURL command line option is (https://curl.haxx.se/docs/manpage.html) and remove the double-dashes? Sorry its just not 100% clear to me on how to specify options just yet. Thank you!

@chriso
Copy link
Contributor

chriso commented Nov 1, 2016

That's right. Options are passed like {"user-agent": "foo bar"} and flags are passed like {"ipv4": true}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants