kayleecodes1 / cas-authentication

A CAS authentication library designed to be used as middleware for an Express server.
MIT License
73 stars 77 forks source link

Allow to override/fill requestOptions variable in _handleTicket #12

Open M3lkior opened 7 years ago

M3lkior commented 7 years ago

Hello @kylepixel,

First, thanks for your library, it works like a charme, great job !

I use your library behind a corporate proxy but unfortunately, node.js http agent don't support corporate proxy and so, is unable to resolve my DNS to contact my CAS server :

Request error with CAS:  { Error: getaddrinfo ENOTFOUND cas.mydns.com cas.mydns.com:443
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'cas.mydns.com',
  host: 'cas.mydns.com',
  port: 443 }

So, to workaround this problem, i'm using https://github.com/TooTallNate/node-https-proxy-agent which allows to define corporate proxy in http.request.agent property :

...
requestOptions.agent = new HttpsProxyAgent('http://proxy.mycompany.com:80');

It's a blocking issue for me, if i do a pull request to allow developpers passing additionals properties to http.request options; could you validate it ?

Thanks !