freezerwatch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/freezerwatch +9 -0
- data/bin/setup +7 -0
- data/freezerwatch.gemspec +23 -0
- data/lib/freezerwatch.rb +5 -0
- data/lib/freezerwatch/version.rb +3 -0
- data/node_modules/.bin/freezerwatch +139 -0
- data/node_modules/freezerwatch/.npmignore +3 -0
- data/node_modules/freezerwatch/.ruby-version +1 -0
- data/node_modules/freezerwatch/Gemfile +4 -0
- data/node_modules/freezerwatch/Gemfile.lock +79 -0
- data/node_modules/freezerwatch/LICENSE +23 -0
- data/node_modules/freezerwatch/README.md +41 -0
- data/node_modules/freezerwatch/Rakefile +13 -0
- data/node_modules/freezerwatch/freezerwatch.js +139 -0
- data/node_modules/freezerwatch/metrics/bigfiles_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/cane_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flay_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/flog_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/punchlist_high_water_mark +2 -0
- data/node_modules/freezerwatch/metrics/reek_high_water_mark +1 -0
- data/node_modules/freezerwatch/metrics/rubocop_high_water_mark +1 -0
- data/node_modules/freezerwatch/node_modules/async/.jshintrc +25 -0
- data/node_modules/freezerwatch/node_modules/async/.travis.yml +6 -0
- data/node_modules/freezerwatch/node_modules/async/CHANGELOG.md +65 -0
- data/node_modules/freezerwatch/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/async/README.md +1803 -0
- data/node_modules/freezerwatch/node_modules/async/bower.json +43 -0
- data/node_modules/freezerwatch/node_modules/async/component.json +17 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/base.css +182 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/async.js.html +3900 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lcov.info +1452 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/async.js.html +3597 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/lib/index.html +73 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.css +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/prettify.js +1 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sort-arrow-sprite.png +0 -0
- data/node_modules/freezerwatch/node_modules/async/coverage/sorter.js +156 -0
- data/node_modules/freezerwatch/node_modules/async/lib/async.js +1191 -0
- data/node_modules/freezerwatch/node_modules/async/nyc_output/5074.json +1 -0
- data/node_modules/freezerwatch/node_modules/async/package.json +96 -0
- data/node_modules/freezerwatch/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/.npmignore +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Client.js +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/Device.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceRawReadStream.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceSingleRawReadStream.js +29 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/DeviceStream.js +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/LICENSE +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/README.md +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.travis.yml +12 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/README.md +364 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/index.js +156 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/copy.js +8 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/debug.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/getSafe.js +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/optional.js +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/.bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/index.js +202 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/index.js +119 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/Readme.md +175 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/lib/form_data.js +351 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/README.md +1647 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/bower.json +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/component.json +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +1123 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/package.json +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +188 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +154 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +99 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +38 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +60 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/package.json +80 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/README.md +627 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/example/usage.js +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/logo.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/browser.js +485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/client.js +367 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/crypto.js +111 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/index.js +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/server.js +524 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/utils.js +183 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +207 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/package.json +64 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +101 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +33 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +10 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +436 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +132 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +585 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +1078 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +5 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +11 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +16 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +25 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +409 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +359 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/browser.js +771 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/client.js +206 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/crypto.js +86 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/index.js +316 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/message.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/readme.js +98 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/server.js +686 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/uri.js +456 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/utils.js +120 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.dir-locals.el +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/LICENSE +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/README.md +79 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/http_signing.md +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/index.js +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/parser.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/signer.js +178 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/util.js +304 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/verify.js +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +50 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +13 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +267 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +36 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +317 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +172 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +296 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +126 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +24 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README +82 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +298 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +245 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +1485 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +944 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +241 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +42 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +129 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +839 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/package.json +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/.npmignore +1 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md +14 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/Makefile +35 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/README.md +52 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/package.json +68 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/stringify.js +27 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js +246 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/LICENSE +19 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/README.md +66 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/mime.js +114 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/package.json +57 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/test.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/mime.types +1588 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/node.types +77 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/.npmignore +2 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/LICENSE.md +21 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/README.md +243 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/README.md +53 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +174 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +34 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +84 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bin/uuid +26 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bower.json +23 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/component.json +18 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/package.json +65 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/compare_v1.js +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.html +17 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.js +228 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/uuid.js +247 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/index.js +43 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/package.json +48 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/test.js +49 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.gitmodules +6 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.npmignore +7 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/Readme.md +58 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/index.js +366 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/package.json +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.jshintrc +72 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.npmignore +3 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/LICENSE +78 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/README.md +380 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +230 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/cookie.js +947 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/memstore.js +102 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +69 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +20 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +176 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +81 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +530 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/package.json +63 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/public-suffix.txt +5229 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/test.js +1340 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/LICENSE +55 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/README.md +4 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/index.js +227 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/package.json +45 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/package.json +74 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/request.js +1244 -0
- data/node_modules/freezerwatch/node_modules/lacrosse/package.json +34 -0
- data/node_modules/freezerwatch/node_modules/optparse/README.md +163 -0
- data/node_modules/freezerwatch/node_modules/optparse/TODO +1 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/browser-test.html +75 -0
- data/node_modules/freezerwatch/node_modules/optparse/examples/nodejs-test.js +86 -0
- data/node_modules/freezerwatch/node_modules/optparse/lib/optparse.js +309 -0
- data/node_modules/freezerwatch/node_modules/optparse/package.json +46 -0
- data/node_modules/freezerwatch/node_modules/optparse/seed.yml +5 -0
- data/node_modules/freezerwatch/node_modules/osenv/.npmignore +13 -0
- data/node_modules/freezerwatch/node_modules/osenv/.travis.yml +9 -0
- data/node_modules/freezerwatch/node_modules/osenv/LICENSE +15 -0
- data/node_modules/freezerwatch/node_modules/osenv/README.md +63 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/index.js +24 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/readme.md +33 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/index.js +25 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/license +21 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/package.json +70 -0
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/readme.md +36 -0
- data/node_modules/freezerwatch/node_modules/osenv/osenv.js +72 -0
- data/node_modules/freezerwatch/node_modules/osenv/package.json +76 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/unix.js +71 -0
- data/node_modules/freezerwatch/node_modules/osenv/test/windows.js +74 -0
- data/node_modules/freezerwatch/node_modules/osenv/x.tap +39 -0
- data/node_modules/freezerwatch/package.json +37 -0
- metadata +384 -0
@@ -0,0 +1,771 @@
|
|
1
|
+
// Load modules
|
2
|
+
|
3
|
+
var Lab = require('lab');
|
4
|
+
var Hoek = require('hoek');
|
5
|
+
var Hawk = require('../lib');
|
6
|
+
var Browser = require('../lib/browser');
|
7
|
+
var LocalStorage = require('localStorage');
|
8
|
+
|
9
|
+
|
10
|
+
// Declare internals
|
11
|
+
|
12
|
+
var internals = {};
|
13
|
+
|
14
|
+
|
15
|
+
// Test shortcuts
|
16
|
+
|
17
|
+
var expect = Lab.expect;
|
18
|
+
var before = Lab.before;
|
19
|
+
var after = Lab.after;
|
20
|
+
var describe = Lab.experiment;
|
21
|
+
var it = Lab.test;
|
22
|
+
|
23
|
+
|
24
|
+
describe('Browser', function () {
|
25
|
+
|
26
|
+
var credentialsFunc = function (id, callback) {
|
27
|
+
|
28
|
+
var credentials = {
|
29
|
+
id: id,
|
30
|
+
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
|
31
|
+
algorithm: (id === '1' ? 'sha1' : 'sha256'),
|
32
|
+
user: 'steve'
|
33
|
+
};
|
34
|
+
|
35
|
+
return callback(null, credentials);
|
36
|
+
};
|
37
|
+
|
38
|
+
it('should generate a header then successfully parse it (configuration)', function (done) {
|
39
|
+
|
40
|
+
var req = {
|
41
|
+
method: 'GET',
|
42
|
+
url: '/resource/4?filter=a',
|
43
|
+
host: 'example.com',
|
44
|
+
port: 8080
|
45
|
+
};
|
46
|
+
|
47
|
+
credentialsFunc('123456', function (err, credentials) {
|
48
|
+
|
49
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
|
50
|
+
expect(req.authorization).to.exist;
|
51
|
+
|
52
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
53
|
+
|
54
|
+
expect(err).to.not.exist;
|
55
|
+
expect(credentials.user).to.equal('steve');
|
56
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
57
|
+
done();
|
58
|
+
});
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
it('should generate a header then successfully parse it (node request)', function (done) {
|
63
|
+
|
64
|
+
var req = {
|
65
|
+
method: 'POST',
|
66
|
+
url: '/resource/4?filter=a',
|
67
|
+
headers: {
|
68
|
+
host: 'example.com:8080',
|
69
|
+
'content-type': 'text/plain;x=y'
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
var payload = 'some not so random text';
|
74
|
+
|
75
|
+
credentialsFunc('123456', function (err, credentials) {
|
76
|
+
|
77
|
+
var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
|
78
|
+
req.headers.authorization = reqHeader.field;
|
79
|
+
|
80
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
81
|
+
|
82
|
+
expect(err).to.not.exist;
|
83
|
+
expect(credentials.user).to.equal('steve');
|
84
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
85
|
+
expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
|
86
|
+
|
87
|
+
var res = {
|
88
|
+
headers: {
|
89
|
+
'content-type': 'text/plain'
|
90
|
+
},
|
91
|
+
getResponseHeader: function (header) {
|
92
|
+
|
93
|
+
return res.headers[header.toLowerCase()];
|
94
|
+
}
|
95
|
+
};
|
96
|
+
|
97
|
+
res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
|
98
|
+
expect(res.headers['server-authorization']).to.exist;
|
99
|
+
|
100
|
+
expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
|
101
|
+
done();
|
102
|
+
});
|
103
|
+
});
|
104
|
+
});
|
105
|
+
|
106
|
+
it('should generate a header then successfully parse it (no server header options)', function (done) {
|
107
|
+
|
108
|
+
var req = {
|
109
|
+
method: 'POST',
|
110
|
+
url: '/resource/4?filter=a',
|
111
|
+
headers: {
|
112
|
+
host: 'example.com:8080',
|
113
|
+
'content-type': 'text/plain;x=y'
|
114
|
+
}
|
115
|
+
};
|
116
|
+
|
117
|
+
var payload = 'some not so random text';
|
118
|
+
|
119
|
+
credentialsFunc('123456', function (err, credentials) {
|
120
|
+
|
121
|
+
var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
|
122
|
+
req.headers.authorization = reqHeader.field;
|
123
|
+
|
124
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
125
|
+
|
126
|
+
expect(err).to.not.exist;
|
127
|
+
expect(credentials.user).to.equal('steve');
|
128
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
129
|
+
expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
|
130
|
+
|
131
|
+
var res = {
|
132
|
+
headers: {
|
133
|
+
'content-type': 'text/plain'
|
134
|
+
},
|
135
|
+
getResponseHeader: function (header) {
|
136
|
+
|
137
|
+
return res.headers[header.toLowerCase()];
|
138
|
+
}
|
139
|
+
};
|
140
|
+
|
141
|
+
res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
|
142
|
+
expect(res.headers['server-authorization']).to.exist;
|
143
|
+
|
144
|
+
expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
|
145
|
+
done();
|
146
|
+
});
|
147
|
+
});
|
148
|
+
});
|
149
|
+
|
150
|
+
it('should generate a header then successfully parse it (no server header)', function (done) {
|
151
|
+
|
152
|
+
var req = {
|
153
|
+
method: 'POST',
|
154
|
+
url: '/resource/4?filter=a',
|
155
|
+
headers: {
|
156
|
+
host: 'example.com:8080',
|
157
|
+
'content-type': 'text/plain;x=y'
|
158
|
+
}
|
159
|
+
};
|
160
|
+
|
161
|
+
var payload = 'some not so random text';
|
162
|
+
|
163
|
+
credentialsFunc('123456', function (err, credentials) {
|
164
|
+
|
165
|
+
var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
|
166
|
+
req.headers.authorization = reqHeader.field;
|
167
|
+
|
168
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
169
|
+
|
170
|
+
expect(err).to.not.exist;
|
171
|
+
expect(credentials.user).to.equal('steve');
|
172
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
173
|
+
expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
|
174
|
+
|
175
|
+
var res = {
|
176
|
+
headers: {
|
177
|
+
'content-type': 'text/plain'
|
178
|
+
},
|
179
|
+
getResponseHeader: function (header) {
|
180
|
+
|
181
|
+
return res.headers[header.toLowerCase()];
|
182
|
+
}
|
183
|
+
};
|
184
|
+
|
185
|
+
expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
|
186
|
+
done();
|
187
|
+
});
|
188
|
+
});
|
189
|
+
});
|
190
|
+
|
191
|
+
it('should generate a header with stale ts and successfully authenticate on second call', function (done) {
|
192
|
+
|
193
|
+
var req = {
|
194
|
+
method: 'GET',
|
195
|
+
url: '/resource/4?filter=a',
|
196
|
+
host: 'example.com',
|
197
|
+
port: 8080
|
198
|
+
};
|
199
|
+
|
200
|
+
credentialsFunc('123456', function (err, credentials) {
|
201
|
+
|
202
|
+
Browser.utils.setNtpOffset(60 * 60 * 1000);
|
203
|
+
var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
|
204
|
+
req.authorization = header.field;
|
205
|
+
expect(req.authorization).to.exist;
|
206
|
+
|
207
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
208
|
+
|
209
|
+
expect(err).to.exist;
|
210
|
+
expect(err.message).to.equal('Stale timestamp');
|
211
|
+
|
212
|
+
var res = {
|
213
|
+
headers: {
|
214
|
+
'www-authenticate': err.response.headers['WWW-Authenticate']
|
215
|
+
},
|
216
|
+
getResponseHeader: function (header) {
|
217
|
+
|
218
|
+
return res.headers[header.toLowerCase()];
|
219
|
+
}
|
220
|
+
};
|
221
|
+
|
222
|
+
expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
|
223
|
+
expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
|
224
|
+
expect(Browser.utils.getNtpOffset()).to.equal(0);
|
225
|
+
|
226
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
|
227
|
+
expect(req.authorization).to.exist;
|
228
|
+
|
229
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
230
|
+
|
231
|
+
expect(err).to.not.exist;
|
232
|
+
expect(credentials.user).to.equal('steve');
|
233
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
234
|
+
done();
|
235
|
+
});
|
236
|
+
});
|
237
|
+
});
|
238
|
+
});
|
239
|
+
|
240
|
+
it('should generate a header with stale ts and successfully authenticate on second call (manual localStorage)', function (done) {
|
241
|
+
|
242
|
+
var req = {
|
243
|
+
method: 'GET',
|
244
|
+
url: '/resource/4?filter=a',
|
245
|
+
host: 'example.com',
|
246
|
+
port: 8080
|
247
|
+
};
|
248
|
+
|
249
|
+
credentialsFunc('123456', function (err, credentials) {
|
250
|
+
Browser.utils.setStorage(LocalStorage)
|
251
|
+
|
252
|
+
Browser.utils.setNtpOffset(60 * 60 * 1000);
|
253
|
+
var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
|
254
|
+
req.authorization = header.field;
|
255
|
+
expect(req.authorization).to.exist;
|
256
|
+
|
257
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
258
|
+
|
259
|
+
expect(err).to.exist;
|
260
|
+
expect(err.message).to.equal('Stale timestamp');
|
261
|
+
|
262
|
+
var res = {
|
263
|
+
headers: {
|
264
|
+
'www-authenticate': err.response.headers['WWW-Authenticate']
|
265
|
+
},
|
266
|
+
getResponseHeader: function (header) {
|
267
|
+
|
268
|
+
return res.headers[header.toLowerCase()];
|
269
|
+
}
|
270
|
+
};
|
271
|
+
|
272
|
+
expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(60 * 60 * 1000);
|
273
|
+
expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
|
274
|
+
expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
|
275
|
+
expect(Browser.utils.getNtpOffset()).to.equal(0);
|
276
|
+
expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(0);
|
277
|
+
|
278
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
|
279
|
+
expect(req.authorization).to.exist;
|
280
|
+
|
281
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
282
|
+
|
283
|
+
expect(err).to.not.exist;
|
284
|
+
expect(credentials.user).to.equal('steve');
|
285
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
286
|
+
done();
|
287
|
+
});
|
288
|
+
});
|
289
|
+
});
|
290
|
+
});
|
291
|
+
|
292
|
+
it('should generate a header then fails to parse it (missing server header hash)', function (done) {
|
293
|
+
|
294
|
+
var req = {
|
295
|
+
method: 'POST',
|
296
|
+
url: '/resource/4?filter=a',
|
297
|
+
headers: {
|
298
|
+
host: 'example.com:8080',
|
299
|
+
'content-type': 'text/plain;x=y'
|
300
|
+
}
|
301
|
+
};
|
302
|
+
|
303
|
+
var payload = 'some not so random text';
|
304
|
+
|
305
|
+
credentialsFunc('123456', function (err, credentials) {
|
306
|
+
|
307
|
+
var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
|
308
|
+
req.headers.authorization = reqHeader.field;
|
309
|
+
|
310
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
311
|
+
|
312
|
+
expect(err).to.not.exist;
|
313
|
+
expect(credentials.user).to.equal('steve');
|
314
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
315
|
+
expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
|
316
|
+
|
317
|
+
var res = {
|
318
|
+
headers: {
|
319
|
+
'content-type': 'text/plain'
|
320
|
+
},
|
321
|
+
getResponseHeader: function (header) {
|
322
|
+
|
323
|
+
return res.headers[header.toLowerCase()];
|
324
|
+
}
|
325
|
+
};
|
326
|
+
|
327
|
+
res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
|
328
|
+
expect(res.headers['server-authorization']).to.exist;
|
329
|
+
|
330
|
+
expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
|
331
|
+
done();
|
332
|
+
});
|
333
|
+
});
|
334
|
+
});
|
335
|
+
|
336
|
+
it('should generate a header then successfully parse it (with hash)', function (done) {
|
337
|
+
|
338
|
+
var req = {
|
339
|
+
method: 'GET',
|
340
|
+
url: '/resource/4?filter=a',
|
341
|
+
host: 'example.com',
|
342
|
+
port: 8080
|
343
|
+
};
|
344
|
+
|
345
|
+
credentialsFunc('123456', function (err, credentials) {
|
346
|
+
|
347
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
|
348
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
349
|
+
|
350
|
+
expect(err).to.not.exist;
|
351
|
+
expect(credentials.user).to.equal('steve');
|
352
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
353
|
+
done();
|
354
|
+
});
|
355
|
+
});
|
356
|
+
});
|
357
|
+
|
358
|
+
it('should generate a header then successfully parse it then validate payload', function (done) {
|
359
|
+
|
360
|
+
var req = {
|
361
|
+
method: 'GET',
|
362
|
+
url: '/resource/4?filter=a',
|
363
|
+
host: 'example.com',
|
364
|
+
port: 8080
|
365
|
+
};
|
366
|
+
|
367
|
+
credentialsFunc('123456', function (err, credentials) {
|
368
|
+
|
369
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
|
370
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
371
|
+
|
372
|
+
expect(err).to.not.exist;
|
373
|
+
expect(credentials.user).to.equal('steve');
|
374
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
375
|
+
expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true;
|
376
|
+
expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false;
|
377
|
+
done();
|
378
|
+
});
|
379
|
+
});
|
380
|
+
});
|
381
|
+
|
382
|
+
it('should generate a header then successfully parse it (app)', function (done) {
|
383
|
+
|
384
|
+
var req = {
|
385
|
+
method: 'GET',
|
386
|
+
url: '/resource/4?filter=a',
|
387
|
+
host: 'example.com',
|
388
|
+
port: 8080
|
389
|
+
};
|
390
|
+
|
391
|
+
credentialsFunc('123456', function (err, credentials) {
|
392
|
+
|
393
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
|
394
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
395
|
+
|
396
|
+
expect(err).to.not.exist;
|
397
|
+
expect(credentials.user).to.equal('steve');
|
398
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
399
|
+
expect(artifacts.app).to.equal('asd23ased');
|
400
|
+
done();
|
401
|
+
});
|
402
|
+
});
|
403
|
+
});
|
404
|
+
|
405
|
+
it('should generate a header then successfully parse it (app, dlg)', function (done) {
|
406
|
+
|
407
|
+
var req = {
|
408
|
+
method: 'GET',
|
409
|
+
url: '/resource/4?filter=a',
|
410
|
+
host: 'example.com',
|
411
|
+
port: 8080
|
412
|
+
};
|
413
|
+
|
414
|
+
credentialsFunc('123456', function (err, credentials) {
|
415
|
+
|
416
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
|
417
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
418
|
+
|
419
|
+
expect(err).to.not.exist;
|
420
|
+
expect(credentials.user).to.equal('steve');
|
421
|
+
expect(artifacts.ext).to.equal('some-app-data');
|
422
|
+
expect(artifacts.app).to.equal('asd23ased');
|
423
|
+
expect(artifacts.dlg).to.equal('23434szr3q4d');
|
424
|
+
done();
|
425
|
+
});
|
426
|
+
});
|
427
|
+
});
|
428
|
+
|
429
|
+
it('should generate a header then fail authentication due to bad hash', function (done) {
|
430
|
+
|
431
|
+
var req = {
|
432
|
+
method: 'GET',
|
433
|
+
url: '/resource/4?filter=a',
|
434
|
+
host: 'example.com',
|
435
|
+
port: 8080
|
436
|
+
};
|
437
|
+
|
438
|
+
credentialsFunc('123456', function (err, credentials) {
|
439
|
+
|
440
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
|
441
|
+
Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
|
442
|
+
|
443
|
+
expect(err).to.exist;
|
444
|
+
expect(err.response.payload.message).to.equal('Bad payload hash');
|
445
|
+
done();
|
446
|
+
});
|
447
|
+
});
|
448
|
+
});
|
449
|
+
|
450
|
+
it('should generate a header for one resource then fail to authenticate another', function (done) {
|
451
|
+
|
452
|
+
var req = {
|
453
|
+
method: 'GET',
|
454
|
+
url: '/resource/4?filter=a',
|
455
|
+
host: 'example.com',
|
456
|
+
port: 8080
|
457
|
+
};
|
458
|
+
|
459
|
+
credentialsFunc('123456', function (err, credentials) {
|
460
|
+
|
461
|
+
req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
|
462
|
+
req.url = '/something/else';
|
463
|
+
|
464
|
+
Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
|
465
|
+
|
466
|
+
expect(err).to.exist;
|
467
|
+
expect(credentials).to.exist;
|
468
|
+
done();
|
469
|
+
});
|
470
|
+
});
|
471
|
+
});
|
472
|
+
|
473
|
+
describe('client', function () {
|
474
|
+
|
475
|
+
describe('#header', function () {
|
476
|
+
|
477
|
+
it('should return a valid authorization header (sha1)', function (done) {
|
478
|
+
|
479
|
+
var credentials = {
|
480
|
+
id: '123456',
|
481
|
+
key: '2983d45yun89q',
|
482
|
+
algorithm: 'sha1'
|
483
|
+
};
|
484
|
+
|
485
|
+
var header = Browser.client.header('http://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about' }).field;
|
486
|
+
expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="bsvY3IfUllw6V5rvk4tStEvpBhE=", ext="Bazinga!", mac="qbf1ZPG/r/e06F4ht+T77LXi5vw="');
|
487
|
+
done();
|
488
|
+
});
|
489
|
+
|
490
|
+
it('should return a valid authorization header (sha256)', function (done) {
|
491
|
+
|
492
|
+
var credentials = {
|
493
|
+
id: '123456',
|
494
|
+
key: '2983d45yun89q',
|
495
|
+
algorithm: 'sha256'
|
496
|
+
};
|
497
|
+
|
498
|
+
var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
|
499
|
+
expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", ext="Bazinga!", mac="q1CwFoSHzPZSkbIvl0oYlD+91rBUEvFk763nMjMndj8="');
|
500
|
+
done();
|
501
|
+
});
|
502
|
+
|
503
|
+
it('should return a valid authorization header (no ext)', function (done) {
|
504
|
+
|
505
|
+
var credentials = {
|
506
|
+
id: '123456',
|
507
|
+
key: '2983d45yun89q',
|
508
|
+
algorithm: 'sha256'
|
509
|
+
};
|
510
|
+
|
511
|
+
var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
|
512
|
+
expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", mac="HTgtd0jPI6E4izx8e4OHdO36q00xFCU0FolNq3RiCYs="');
|
513
|
+
done();
|
514
|
+
});
|
515
|
+
|
516
|
+
it('should return an empty authorization header on missing options', function (done) {
|
517
|
+
|
518
|
+
var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST').field;
|
519
|
+
expect(header).to.equal('');
|
520
|
+
done();
|
521
|
+
});
|
522
|
+
|
523
|
+
it('should return an empty authorization header on invalid credentials', function (done) {
|
524
|
+
|
525
|
+
var credentials = {
|
526
|
+
key: '2983d45yun89q',
|
527
|
+
algorithm: 'sha256'
|
528
|
+
};
|
529
|
+
|
530
|
+
var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207 }).field;
|
531
|
+
expect(header).to.equal('');
|
532
|
+
done();
|
533
|
+
});
|
534
|
+
|
535
|
+
it('should return an empty authorization header on invalid algorithm', function (done) {
|
536
|
+
|
537
|
+
var credentials = {
|
538
|
+
id: '123456',
|
539
|
+
key: '2983d45yun89q',
|
540
|
+
algorithm: 'hmac-sha-0'
|
541
|
+
};
|
542
|
+
|
543
|
+
var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, payload: 'something, anything!', ext: 'Bazinga!', timestamp: 1353809207 }).field;
|
544
|
+
expect(header).to.equal('');
|
545
|
+
done();
|
546
|
+
});
|
547
|
+
});
|
548
|
+
|
549
|
+
describe('#authenticate', function () {
|
550
|
+
|
551
|
+
it('should return false on invalid header', function (done) {
|
552
|
+
|
553
|
+
var res = {
|
554
|
+
headers: {
|
555
|
+
'server-authorization': 'Hawk mac="abc", bad="xyz"'
|
556
|
+
},
|
557
|
+
getResponseHeader: function (header) {
|
558
|
+
|
559
|
+
return res.headers[header.toLowerCase()];
|
560
|
+
}
|
561
|
+
};
|
562
|
+
|
563
|
+
expect(Browser.client.authenticate(res, {})).to.equal(false);
|
564
|
+
done();
|
565
|
+
});
|
566
|
+
|
567
|
+
it('should return false on invalid mac', function (done) {
|
568
|
+
|
569
|
+
var res = {
|
570
|
+
headers: {
|
571
|
+
'content-type': 'text/plain',
|
572
|
+
'server-authorization': 'Hawk mac="_IJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
|
573
|
+
},
|
574
|
+
getResponseHeader: function (header) {
|
575
|
+
|
576
|
+
return res.headers[header.toLowerCase()];
|
577
|
+
}
|
578
|
+
};
|
579
|
+
|
580
|
+
var artifacts = {
|
581
|
+
method: 'POST',
|
582
|
+
host: 'example.com',
|
583
|
+
port: '8080',
|
584
|
+
resource: '/resource/4?filter=a',
|
585
|
+
ts: '1362336900',
|
586
|
+
nonce: 'eb5S_L',
|
587
|
+
hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
|
588
|
+
ext: 'some-app-data',
|
589
|
+
app: undefined,
|
590
|
+
dlg: undefined,
|
591
|
+
mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
|
592
|
+
id: '123456'
|
593
|
+
};
|
594
|
+
|
595
|
+
var credentials = {
|
596
|
+
id: '123456',
|
597
|
+
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
|
598
|
+
algorithm: 'sha256',
|
599
|
+
user: 'steve'
|
600
|
+
};
|
601
|
+
|
602
|
+
expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(false);
|
603
|
+
done();
|
604
|
+
});
|
605
|
+
|
606
|
+
it('should return true on ignoring hash', function (done) {
|
607
|
+
|
608
|
+
var res = {
|
609
|
+
headers: {
|
610
|
+
'content-type': 'text/plain',
|
611
|
+
'server-authorization': 'Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
|
612
|
+
},
|
613
|
+
getResponseHeader: function (header) {
|
614
|
+
|
615
|
+
return res.headers[header.toLowerCase()];
|
616
|
+
}
|
617
|
+
};
|
618
|
+
|
619
|
+
var artifacts = {
|
620
|
+
method: 'POST',
|
621
|
+
host: 'example.com',
|
622
|
+
port: '8080',
|
623
|
+
resource: '/resource/4?filter=a',
|
624
|
+
ts: '1362336900',
|
625
|
+
nonce: 'eb5S_L',
|
626
|
+
hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
|
627
|
+
ext: 'some-app-data',
|
628
|
+
app: undefined,
|
629
|
+
dlg: undefined,
|
630
|
+
mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
|
631
|
+
id: '123456'
|
632
|
+
};
|
633
|
+
|
634
|
+
var credentials = {
|
635
|
+
id: '123456',
|
636
|
+
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
|
637
|
+
algorithm: 'sha256',
|
638
|
+
user: 'steve'
|
639
|
+
};
|
640
|
+
|
641
|
+
expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
|
642
|
+
done();
|
643
|
+
});
|
644
|
+
|
645
|
+
it('should fail on invalid WWW-Authenticate header format', function (done) {
|
646
|
+
|
647
|
+
var res = {
|
648
|
+
headers: {
|
649
|
+
'www-authenticate': 'Hawk ts="1362346425875", tsm="PhwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", x="Stale timestamp"'
|
650
|
+
},
|
651
|
+
getResponseHeader: function (header) {
|
652
|
+
|
653
|
+
return res.headers[header.toLowerCase()];
|
654
|
+
}
|
655
|
+
};
|
656
|
+
|
657
|
+
expect(Browser.client.authenticate(res, {})).to.equal(false);
|
658
|
+
done();
|
659
|
+
});
|
660
|
+
|
661
|
+
it('should fail on invalid WWW-Authenticate header format', function (done) {
|
662
|
+
|
663
|
+
var credentials = {
|
664
|
+
id: '123456',
|
665
|
+
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
|
666
|
+
algorithm: 'sha256',
|
667
|
+
user: 'steve'
|
668
|
+
};
|
669
|
+
|
670
|
+
var res = {
|
671
|
+
headers: {
|
672
|
+
'www-authenticate': 'Hawk ts="1362346425875", tsm="hwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", error="Stale timestamp"'
|
673
|
+
},
|
674
|
+
getResponseHeader: function (header) {
|
675
|
+
|
676
|
+
return res.headers[header.toLowerCase()];
|
677
|
+
}
|
678
|
+
};
|
679
|
+
|
680
|
+
expect(Browser.client.authenticate(res, credentials)).to.equal(false);
|
681
|
+
done();
|
682
|
+
});
|
683
|
+
});
|
684
|
+
|
685
|
+
describe('#message', function () {
|
686
|
+
it('should generate an authorization then successfully parse it', function (done) {
|
687
|
+
|
688
|
+
credentialsFunc('123456', function (err, credentials) {
|
689
|
+
|
690
|
+
var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials });
|
691
|
+
expect(auth).to.exist;
|
692
|
+
|
693
|
+
Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
|
694
|
+
|
695
|
+
expect(err).to.not.exist;
|
696
|
+
expect(credentials.user).to.equal('steve');
|
697
|
+
done();
|
698
|
+
});
|
699
|
+
});
|
700
|
+
});
|
701
|
+
|
702
|
+
it('should fail on missing host', function (done) {
|
703
|
+
|
704
|
+
credentialsFunc('123456', function (err, credentials) {
|
705
|
+
|
706
|
+
var auth = Browser.client.message(null, 8080, 'some message', { credentials: credentials });
|
707
|
+
expect(auth).to.not.exist;
|
708
|
+
done();
|
709
|
+
});
|
710
|
+
});
|
711
|
+
|
712
|
+
it('should fail on missing credentials', function (done) {
|
713
|
+
|
714
|
+
var auth = Browser.client.message('example.com', 8080, 'some message', {});
|
715
|
+
expect(auth).to.not.exist;
|
716
|
+
done();
|
717
|
+
});
|
718
|
+
|
719
|
+
it('should fail on invalid algorithm', function (done) {
|
720
|
+
|
721
|
+
credentialsFunc('123456', function (err, credentials) {
|
722
|
+
|
723
|
+
var creds = Hoek.clone(credentials);
|
724
|
+
creds.algorithm = 'blah';
|
725
|
+
var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: creds });
|
726
|
+
expect(auth).to.not.exist;
|
727
|
+
done();
|
728
|
+
});
|
729
|
+
});
|
730
|
+
});
|
731
|
+
});
|
732
|
+
|
733
|
+
describe('#parseAuthorizationHeader', function (done) {
|
734
|
+
|
735
|
+
it('returns null on missing header', function (done) {
|
736
|
+
|
737
|
+
expect(Browser.utils.parseAuthorizationHeader()).to.equal(null);
|
738
|
+
done();
|
739
|
+
});
|
740
|
+
|
741
|
+
it('returns null on bad header syntax (structure)', function (done) {
|
742
|
+
|
743
|
+
expect(Browser.utils.parseAuthorizationHeader('Hawk')).to.equal(null);
|
744
|
+
done();
|
745
|
+
});
|
746
|
+
|
747
|
+
it('returns null on bad header syntax (parts)', function (done) {
|
748
|
+
|
749
|
+
expect(Browser.utils.parseAuthorizationHeader(' ')).to.equal(null);
|
750
|
+
done();
|
751
|
+
});
|
752
|
+
|
753
|
+
it('returns null on bad scheme name', function (done) {
|
754
|
+
|
755
|
+
expect(Browser.utils.parseAuthorizationHeader('Basic asdasd')).to.equal(null);
|
756
|
+
done();
|
757
|
+
});
|
758
|
+
|
759
|
+
it('returns null on bad attribute value', function (done) {
|
760
|
+
|
761
|
+
expect(Browser.utils.parseAuthorizationHeader('Hawk test="\t"', ['test'])).to.equal(null);
|
762
|
+
done();
|
763
|
+
});
|
764
|
+
|
765
|
+
it('returns null on duplicated attribute', function (done) {
|
766
|
+
|
767
|
+
expect(Browser.utils.parseAuthorizationHeader('Hawk test="a", test="b"', ['test'])).to.equal(null);
|
768
|
+
done();
|
769
|
+
});
|
770
|
+
});
|
771
|
+
});
|