connect-cas icon indicating copy to clipboard operation
connect-cas copied to clipboard

Support agentOptions configuration for requests to CAS server

Open mikesir87 opened this issue 7 years ago • 0 comments

Motivation

Since CAS is such an important auth protocol, we want to make sure we trust the other end when making validations/working with proxy ticketing. In order to do that, we'd like to be able to specify agentOptions on requests being made to the CAS server. Two use cases...

  • In local dev and test environments, we frequently use self-signed certs. So, we'd like to be able to specify the CA cert to trust (rather than be dumb and use NODE_TLS_REJECT_UNAUTHORIZED).
  • In production, we'd like to be able to support cert pinning, adding additional validation that the other end is what we'd expect.

Implementation

To implement, I added support for agentOptions to the configure() method, which defaults simply to {} and is passed along to all calls to request.

I also updated the test suite with new certs/keys that 1) don't include the port number in the CN and 2) are signed by a rootCA and updated the CAS servers to use them (it was speaking plain HTTP before). I included the csr and root CA key in case you want to reuse it or whatever. Totally up to you if you want to nuke those.

If you remove the setting of the agentOptions in all cas.configure calls in the test suite, you'll see that they fail. I'm more than happy to add/consider other tests that should fit into this, if you can think of any others.

mikesir87 avatar Jul 31 '18 04:07 mikesir87