{"_id":"@byu-oit/xcas","_rev":"18-d9463afd62b06218aada03488beede3f","name":"@byu-oit/xcas","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@byu-oit/xcas","version":"1.0.0","author":{"name":"Francois Montmasson","email":"fmontmasson@gmail.com"},"_id":"@byu-oit/xcas@1.0.0","maintainers":[{"name":"blakemorgan","email":"b.morgan.296@gmail.com"},{"name":"byujol","email":"byujol@gmail.com"},{"name":"yoshutch","email":"scott_hutchings@byu.edu"},{"name":"lehinpm","email":"lehi_alcantara@byu.edu"},{"name":"oscea","email":"it@byu.edu"},{"name":"stuft2","email":"spencer.tuft@gmail.com"},{"name":"pauldeden","email":"byu-oit-npmjs@byu.edu"},{"name":"mhailstone","email":"matthew.hailstone@gmail.com"},{"name":"thatjoemoore","email":"npm@thatjoemoore.com"},{"name":"gi60s","email":"james.speirs@gmail.com"},{"name":"arasmus8","email":"arasmus8@gmail.com"},{"name":"garygsc","email":"garygsc@gmail.com"}],"homepage":"https://github.com/byu-oit/xcas#readme","bugs":{"url":"https://github.com/byu-oit/xcas/issues"},"dist":{"shasum":"9a14829951489556ca0012234de69e3623d065f8","tarball":"https://registry.npmjs.org/@byu-oit/xcas/-/xcas-1.0.0.tgz","fileCount":8,"integrity":"sha512-A0XYOYZ/IKAh7y2NucbwtzduPehz5LC8QeWqGaOWwalMRLv48AL0DmZbOlyBmr7k1en0f2lQyTMls3fJndByIA==","signatures":[{"sig":"MEUCIQCm4NVHdq6euhFCgogYp5sJtfE4uZymIXeCnL64SrdojQIgVMMKgY7FwgOjcBotzkI5BbN1fcU9ZuKp8Wb9fmr+3eY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59172,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5YCWCRA9TVsSAnZWagAA6+gQAIwnLc+kYLjeb+IPI+65\nam1OSvOgRXV76WiHyhpW0N5OhVr4CMZumvrMKgYAEBMC0xW483zCTViN5++a\nwu54g9p5YY4YnCwJOZG3uv8naiGZXF1jvVQhqrQjZjR02Z5cIMcnAWZ+SI3Y\noHH/3QMMS8zmlRi8opcQbpt+dUXEeJGtbPxhqGrREbH/7LvBK1C+1pWNYwRr\nW537UyYJ18KGPETrlzoktiBkIxDHcALNr5Qk9ZZNV5ZxOobqkxOuL8M5jA/q\nnKxl3dNiI5+nHLX6zhIktrufcx3TaJwWIYbqSHX4Cso63erUI33mpRTJKGmc\nUohQCOj8VQm2/LnoVSZVkmXnLLmZtMHI/h/2Wu+9AxMtU9mif8DEmfh3o6ia\nuXeEHqHiNAv1ZyLj/KZdce+MCD4c82AggqzYfCE7F35OHCgw5X+vpz2WCQT0\nBTHGWIPQtW45EOV+SK9CV73TsS+QuAlinrHI1z1qkym6No4GYurdrIqtRys2\npIeCNflc0X/ALWFDjKUusOjiW6fyBJGW5Xn/YFMolOAwrzc2uK8c4/Uvpd2q\n2Re/0TtqVvLnoZOovqkZN09MV0eCLFvLsrcIIWdmMkeFB52q2Psj3ZnlJNT0\nA4ErVNOmw7XAMolwNuQS4mYjpi3/HaADN/9q5Uf2zXL1Lf4DpKNEozjBjMdk\nVFlX\r\n=0gQ5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index","gitHead":"4ce2008789d679e9eb5873198e3b0d2f466a0179","_npmUser":{"name":"arasmus8","email":"arasmus8@gmail.com"},"repository":{"url":"git+https://github.com/byu-oit/xcas.git","type":"git"},"_npmVersion":"6.9.0","description":"Extended Central Authentication Service (CAS) client for Node.js","directories":{},"_nodeVersion":"10.14.1","dependencies":{"xml2js":"^0.4.19"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/xcas_1.0.0_1558544533941_0.27590659649222027","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@byu-oit/xcas","version":"1.0.1","author":{"name":"Francois Montmasson","email":"fmontmasson@gmail.com"},"_id":"@byu-oit/xcas@1.0.1","maintainers":[{"name":"arasmus8","email":"arasmus8@gmail.com"},{"name":"blakemorgan","email":"b.morgan.296@gmail.com"},{"name":"byujol","email":"byujol@gmail.com"},{"name":"garygsc","email":"garygsc@gmail.com"},{"name":"gi60s","email":"james.speirs@gmail.com"},{"name":"lehinpm","email":"lehi_alcantara@byu.edu"},{"name":"mhailstone","email":"matthew.hailstone@gmail.com"},{"name":"oscea","email":"it@byu.edu"},{"name":"pauldeden","email":"byu-oit-npmjs@byu.edu"},{"name":"stuft2","email":"spencer.tuft@gmail.com"},{"name":"thatjoemoore","email":"npm@thatjoemoore.com"},{"name":"yoshutch","email":"scott_hutchings@byu.edu"}],"homepage":"https://github.com/byu-oit/xcas#readme","bugs":{"url":"https://github.com/byu-oit/xcas/issues"},"dist":{"shasum":"892605299a4c70070232d537c4a318cff3b639e7","tarball":"https://registry.npmjs.org/@byu-oit/xcas/-/xcas-1.0.1.tgz","fileCount":7,"integrity":"sha512-wSbRTXgvVt2fBBCF8zdQTKeZet6qMCiaZWikVBiHmVSsQHpCRB1P7FM9HkMEnb/k9kYm+dvGM5ctHcpEGJZHVA==","signatures":[{"sig":"MEUCID7loVPLGSjfexI5QUQZHQn8/hMJg/CarBB6OEGBLSnLAiEA6YgFcuYwnElZeqbWo5eUg6Dis5Te8De8SpK8lZ3p1t4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5YRMCRA9TVsSAnZWagAAtbkP/jLlBMq6ju/PqY/w3xrP\nD0Stm71XQ3vwkEnkJaKeQtUEPFimtvxwi5xTf1r6eHsDDjXj7PY5VGitlbO+\nveTNqVkRT3Eddk6kPprNBRNHmHk+/wZNwgmRsOEFNIBh0psd1Byoq1hIWYC4\nddDloe3OhNbruRM+Qo7ex/PWtsplBTLgDhY4BZG5KXtU5X44UVzcNObMdWut\nWeO96J7cfoJZsJT/b2QE60WWYhke1C3E5XUYotpKKm1C11FxQ7LfyocSpxjl\nqiWG2ho6CurebmPZIGL0vbC5kj3x6C377+iYRRUX/RzWAh2oSh2tHgEarceL\ni/KEb50YCjnfL6OFfvx7vhZiLbOibiY54kIafc7TSo9QRI9lt0I/c2ZhhR45\nF/mxnTI2zgQNQC7vadgJjaB2fiJFnK5minvtRlqKnofE3WV+k0hoQgLCriKC\nAAUm71cCzHKky9MoTLjl3wCd5kGRf8dZ9pbmO5dmVAySmYqm836HrE6YQbBY\noOXr4Hri/DlMt2byHWA48g6u+mks2z3zrMALnMB2TgC9D7YuUcedZeY6YR7n\n5rbRGa+4Md2ia7ix6KxJKFZ/RT8FHYAC1zdfSSGgzgU6OtXdXnPoK1/bvoq7\nSVYT3FN3UIWcqQX1C9EE7i1EdIOtnvRR3yJfsLlCx/dB1Ptns54aZK/rDWAj\nRMMZ\r\n=3bR3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index","gitHead":"271d015091b7c3c6f3d198ae348b42d3f8a9eef9","_npmUser":{"name":"arasmus8","email":"arasmus8@gmail.com"},"repository":{"url":"git+https://github.com/byu-oit/xcas.git","type":"git"},"_npmVersion":"6.9.0","description":"Extended Central Authentication Service (CAS) client for Node.js","directories":{},"_nodeVersion":"10.14.1","dependencies":{"xml2js":"^0.4.19"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/xcas_1.0.1_1558545484064_0.6088828648454201","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-05-22T17:02:13.811Z","modified":"2026-07-06T18:20:45.558Z","1.0.0":"2019-05-22T17:02:14.119Z","1.0.1":"2019-05-22T17:18:04.183Z"},"bugs":{"url":"https://github.com/byu-oit/xcas/issues"},"author":{"name":"Francois Montmasson","email":"fmontmasson@gmail.com"},"homepage":"https://github.com/byu-oit/xcas#readme","repository":{"url":"git+https://github.com/byu-oit/xcas.git","type":"git"},"description":"Extended Central Authentication Service (CAS) client for Node.js","maintainers":[{"email":"scott_hutchings@byu.edu","name":"yoshutch"},{"email":"lehi_alcantara@byu.edu","name":"lehinpm"},{"email":"it@byu.edu","name":"oscea"},{"email":"stuft2@protonmail.com","name":"stuft2"},{"email":"matthew.hailstone@gmail.com","name":"mhailstone"},{"email":"arasmus8@gmail.com","name":"arasmus8"},{"email":"garygsc@gmail.com","name":"garygsc"},{"email":"github@snelg.com","name":"snelg"},{"email":"danielduraesm@gmail.com","name":"gholl0"},{"email":"developertools@byu.edu","name":"byu-oit-bot"},{"email":"micah.weatherhead@gmail.com","name":"mjweather"},{"email":"jvisker@byu.edu","name":"jvisker"}],"readme":"# cas\n\n  Central Authentication Service (CAS) client for Node.js\n\n  This module handles CAS authentication (with support for proxies and extended attributes), and can also transparently redirect a web page if needed. The ticket validation step is available as its own function for those who wish to handle things manually. Proxied requests can be made through a function call, or optionally through an HTTP request with custom headers. Single sign out is also supported with Express/Connect.\n  \n  To start the login process manually, send your users to: `https://cas_base_url/login?service=url_to_handle_ticket_validation`. In the University of Waterloo example below, this url would be: `https://cas.uwaterloo.ca/cas/login?service='my_service'`.\n  \n  Or if you are using standard HTTP req/res objects for a web page, you may use the provided `authenticate()` function to handle the redirection automatically.\n  \n  It is also possible to use this as a standalone CAS proxy server.\n  \n  \n\n## Installation\n\nvia npm:\n\n    $ npm install cas\n\n## Usage\n\nSetup:\n\n```javascript\n    var CAS = require('cas');\n    var cas = new CAS({\n        base_url: 'https://cas.uwaterloo.ca/cas', \n        service: 'my_service',\n        version: 2.0\n    });\n```\n\nUsing it in a login route:\n\n```javascript\n    exports.cas_login = function(req, res) {\n      var ticket = req.param('ticket');\n      if (ticket) {\n        cas.validate(ticket, function(err, status, username) {\n          if (err) {\n            // Handle the error\n            res.send({error: err});\n          } else {\n            // Log the user in\n            res.send({status: status, username: username});\n          }\n        });\n      } else {\n        res.redirect('/');\n      }\n    };\n```\n\nUsing the auto redirect authentication:\n\n```javascript\n    exports.cas_login = function(req, res) {\n      cas.authenticate(req, res, function(err, status, username, extended) {\n        if (err) {\n          // Handle the error\n          res.send({error: err});\n        } else {\n          // Log the user in \n          res.send({status: status, username: username, attributes: extended.attributes});\n        }\n      });    \n    }\n```\n\nLonger example with CAS proxy (also see the [wiki](https://github.com/joshchan/node-cas/wiki/CAS-Proxy)):\n\n```javascript\n    var fs = require('fs');\n    var http = require('http');\n\n    // Initialize CAS\n    var CAS = require('cas');\n    var cas = new CAS({\n        base_url: 'https://cas.uwaterloo.ca/cas',\n        version: 2.0,\n        \n        proxy_server: true,\n        proxy_server_port: 0, // disable inbound external proxy connections\n        proxy_server_key: fs.readFileSync('/path/to/private_key.pem'),\n        proxy_server_cert: fs.readFileSync('/path/to/ssl_cert.pem'),\n        \n        // CAS server will connect to this. It must be accessible on the\n        // public internet.\n        proxy_callback_host: 'my-public-domain.example.com',\n        proxy_callback_port: 8989\n    });\n    \n    // Main web server\n    var server = http.createServer();\n    server.addListener('request', function(req, res) {\n\n        var ip = req.connection.remoteAddress\n             || req.socket.remoteAddress \n             || req.connection.socket.remoteAddress;\n        \n        cas.authenticate(req, res, function(err, status, username, extended) {\n            if (err) {\n                res.end(err.message);\n                return;\n            }\n            \n            // At this point the user has been authenticated. In a real web\n            // framework you would want to use sessions to track the info.\n            \n            res.writeHead(200, {'Content-Type': 'text/html'});\n            res.write('<div style=\"border:solid 1px black; padding:1em; margin:1em;\">');\n            res.write('<p>Welcome ' + username + '. Your IP address is ' + ip + '.</p>');\n            res.write('<p>You are here: <b>http://' + req.headers.host + req.url + '</b></p>');\n            \n            // CAS server should return a PGTIOU since we specified a proxy\n            var pgtIOU = extended['PGTIOU'];\n            if (pgtIOU) {\n                res.write('<p>');\n                res.write('Your PGTIOU for this session is: ' + pgtIOU + '<br/>');\n                res.write('Your web framework should keep track of this if it wants to use CAS proxied services on your behalf.<br/>');\n                res.write('</p>');\n            \n                // For testing the proxy function at \"/proxyDirect\"\n                if (req.url.match(/proxyDirect/)) {\n                    res.write('Starting direct proxy request...<br/>');\n                    \n                    // Fetch http://localhost:8080/test through the proxy on user's behalf\n                    cas.proxiedRequest(pgtIOU, {\n                        protocol: 'http:',\n                        method: 'GET',\n                        hostname: 'localhost',\n                        port: 8080,\n                        pathname: '/test'\n                    }, function(err, proxyReq, proxyRes) {\n                        // Just display the proxied results directly\n                        proxyRes.on('data', function(chunk) {\n                            res.write(chunk);\n                        });\n                        proxyRes.on('end', function() {\n                            res.write('Proxy Done<br/>');\n                            res.write('</div>');\n                            res.end();\n                        });\n                    });\n                    \n                    return;\n                } // end of \"/proxyDirect\"\n            }\n            \n            // Normal requests, such as to \"/test\"\n            res.write('Done<br/>');\n            res.write('</div>');\n            res.end();\n        \n        });\n        \n    });\n    server.listen(8080);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 Casey Banner &lt;kcbanner@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","readmeFilename":"Readme.md"}