Skip to content

Instantly share code, notes, and snippets.

@dariocravero
Last active February 19, 2016 14:32
Show Gist options
  • Save dariocravero/ac04a8086a69a2c0629d to your computer and use it in GitHub Desktop.
Save dariocravero/ac04a8086a69a2c0629d to your computer and use it in GitHub Desktop.
couch_jwt_auth [master*] $ ./build.sh
==> erlsha2 (get-deps)
==> jsx (get-deps)
==> ejwt (get-deps)
==> couch_jwt_auth (get-deps)
==> erlsha2 (compile)
Compiling c_src/erlsha2_nif.c
Compiling c_src/hmac_nif.c
==> jsx (compile)
==> ejwt (compile)
==> couch_jwt_auth (compile)
==> couch_jwt_auth (eunit)
======================== EUnit ========================
module 'couch_jwt_auth'
couch_jwt_auth: decode_malformed_empty_test...[0.015 s] ok
couch_jwt_auth: decode_malformed_dots_test...[0.006 s] ok
couch_jwt_auth: decode_malformed_nosignature1_test...ok
couch_jwt_auth: decode_malformed_nosignature2_test...[0.011 s] ok
couch_jwt_auth: decode_simple_test...[0.007 s] ok
couch_jwt_auth: decode_unsecured_test...ok
couch_jwt_auth: validate_simple_test...ok
couch_jwt_auth: validate_exp_nbf_test...ok
couch_jwt_auth: validate_exp_rejected_test...ok
couch_jwt_auth: validate_nbf_rejected_test...ok
couch_jwt_auth: validate_aud1_rejected_test...[0.004 s] ok
couch_jwt_auth: validate_aud2_rejected_test...ok
couch_jwt_auth: validate_aud_pass_test...ok
couch_jwt_auth: validate_claims_pass_test...ok
couch_jwt_auth: posix_time1_test...ok
couch_jwt_auth: posix_time2_test...ok
couch_jwt_auth: get_userinfo_from_token_default_test...ok
couch_jwt_auth: get_userinfo_from_token_configured_test...ok
couch_jwt_auth: get_userinfo_from_token_name_not_found_test...ok
[done in 0.100 s]
=======================================================
All 19 tests passed.
couch_jwt_auth [master*] $ make plugin
rebar compile
==> erlsha2 (compile)
Compiling c_src/erlsha2_nif.c
Compiling c_src/hmac_nif.c
==> jsx (compile)
==> ejwt (compile)
==> couch_jwt_auth (compile)
mkdir -p couch_jwt_auth-1.0.1-18-1.6.1
cp -r ebin priv couch_jwt_auth-1.0.1-18-1.6.1
tar czf couch_jwt_auth-1.0.1-18-1.6.1.tar.gz couch_jwt_auth-1.0.1-18-1.6.1
couch_jwt_auth-1.0.1-18-1.6.1.tar.gz: K4zZeiS4yILsiL8mm0xUXl//fw8=
couch_jwt_auth [master*] $ static
serving "." at http://127.0.0.1:8080
14:17:31 [200]: /couch_jwt_auth-1.0.1-18-1.6.1.tar.gz
couch_jwt_auth [master*] $ file couch_jwt_auth-1.0.1-18-1.6.1.tar.gz
couch_jwt_auth-1.0.1-18-1.6.1.tar.gz: gzip compressed data, from Unix, last modified: Fri Feb 19 14:17:26 2016
couch_jwt_auth [master*] $ tar tvf couch_jwt_auth-1.0.1-18-1.6.1.tar.gz
drwxr-xr-x craverod/163264107 0 2016-02-19 13:39 couch_jwt_auth-1.0.1-18-1.6.1/
drwxr-xr-x craverod/163264107 0 2016-02-19 13:39 couch_jwt_auth-1.0.1-18-1.6.1/ebin/
-rw-r--r-- craverod/163264107 3528 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/base64url.beam
-rw-r--r-- craverod/163264107 506 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/couch_jwt_auth.app
-rw-r--r-- craverod/163264107 7768 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/couch_jwt_auth.beam
-rw-r--r-- craverod/163264107 271 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/ejwt.app
-rw-r--r-- craverod/163264107 3116 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/ejwt.beam
-rw-r--r-- craverod/163264107 246 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/erlsha2.app
-rw-r--r-- craverod/163264107 15940 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/erlsha2.beam
-rw-r--r-- craverod/163264107 4700 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/hmac.beam
-rw-r--r-- craverod/163264107 359 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx.app
-rw-r--r-- craverod/163264107 3940 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx.beam
-rw-r--r-- craverod/163264107 69364 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_decoder.beam
-rw-r--r-- craverod/163264107 29316 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_encoder.beam
-rw-r--r-- craverod/163264107 32228 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_parser.beam
-rw-r--r-- craverod/163264107 7916 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_to_json.beam
-rw-r--r-- craverod/163264107 4888 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_to_term.beam
-rw-r--r-- craverod/163264107 5904 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_utils.beam
-rw-r--r-- craverod/163264107 3236 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/ebin/jsx_verify.beam
drwxr-xr-x craverod/163264107 0 2016-02-19 13:39 couch_jwt_auth-1.0.1-18-1.6.1/priv/
drwxr-xr-x craverod/163264107 0 2016-02-19 13:39 couch_jwt_auth-1.0.1-18-1.6.1/priv/default.d/
-rw-r--r-- craverod/163264107 531 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/priv/default.d/jwt_auth.ini
-rwxr-xr-x craverod/163264107 20692 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/priv/erlsha2_nif.so
-rwxr-xr-x craverod/163264107 9392 2016-02-19 14:17 couch_jwt_auth-1.0.1-18-1.6.1/priv/hmac_nif.so
[debug] [<0.1633.0>] 'POST' /_plugins {1,1} from "127.0.0.1"
Headers: [{'Accept',"*/*"},
{'Authorization',"Basic dGVzdDpwYXNz"},
{'Content-Length',"153"},
{'Content-Type',"application/json"},
{'Host',"localhost:5984"},
{'User-Agent',"curl/7.43.0"}]
[debug] [<0.1633.0>] OAuth Params: []
[debug] [<0.1633.0>] [couch_plugins] "Installing couch_jwt_auth"
[debug] [<0.1633.0>] [couch_plugins] "downloading http://localhost:8080/couch_jwt_auth-1.0.1-18-1.6.1.tar.gz"
[debug] [<0.1633.0>] [couch_plugins] "downloaded to /tmp/couch_jwt_auth-1.0.1-18-1.6.1.tar.gz"
[debug] [<0.1633.0>] Checking Filename: /tmp/couch_jwt_auth-1.0.1-18-1.6.1.tar.gz
[debug] [<0.1633.0>] [couch_plugins] "checksum verified"
[debug] [<0.1633.0>] [couch_plugins] "unzipped"
[error] [<0.1633.0>] Uncaught error in HTTP request: {error,
{badmatch,
{error,bad_header}}}
[info] [<0.1633.0>] Stacktrace: [{couch_plugins,install,1,
[{file,"src/couch_plugins.erl"},
{line,37}]},
{couch_plugins_httpd,handle_req,1,
[{file,"src/couch_plugins_httpd.erl"},
{line,31}]},
{couch_httpd,handle_request_int,5,
[{file,"couch_httpd.erl"},{line,318}]},
{mochiweb_http,headers,5,
[{file,"mochiweb_http.erl"},{line,94}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,240}]}]
[info] [<0.1633.0>] 127.0.0.1 - - POST /_plugins 500
[error] [<0.1633.0>] httpd 500 error response:
{"error":"badmatch","reason":"{error,bad_header}"}
couch_jwt_auth [master*] $ curl -X POST http://test:pass@localhost:5984/_plugins -HContent-type:application/json -d '{"name":"couch_jwt_auth","url":"http://localhost:8080", "version":"1.0.1", "checksums":{"1.6.1":{"18": "SbeczyfwaZKSmpKQa26U4GvHI6s="}}, "delete": false}'
{"error":"badmatch","reason":"{error,bad_header}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment