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 agentOptions configuration for requests to CAS server #50

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mikesir87
Copy link

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.

With previous version, tests would fail when comparing query
string values, as (for some reason), req.query would also contain
{__proto__: ""}, which would then then encoded into the URL.
This allows the same cert to be used for both cas and app server
in the tests. But, it causes problems when the port is included,
but doesn't match what the server is using.

Create rootCA that can sign the request, allowing future work
to specify the CA to trust when communicating with the CAS server
for validations
All tests were updated to make the CAS server run using HTTPS and
the cas configuration was updated to use the CA cert to verify
it all works.
(Might it be time to consider updating the node_js version used
in the travis builds??)
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

Successfully merging this pull request may close these issues.

1 participant