Skip to content
This repository was archived by the owner on Feb 14, 2018. It is now read-only.

Commit 3b3d1f3

Browse files
committed
Merge branch 'master' of https://github.com/auth0/nginx-jwt
2 parents 4782495 + 3a3e9bb commit 3b3d1f3

File tree

5 files changed

+48
-14
lines changed

5 files changed

+48
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ npm-debug.log
4848
# Other
4949
*.lua.swp
5050
lib/
51+
nginx-jwt.tar.gz

README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
- [Key Features](#key-features)
88
- [Install](#install)
9+
- [Configuration](#configuration)
910
- [Usage](#usage)
1011
- [API Reference](#api-reference)
1112
- [Tests](#tests)
13+
- [Packaging](#packaging)
1214
- [Issue Reporting](#issue-reporting)
1315
- [Contributors](#contributors)
1416
- [License](#license)
@@ -21,21 +23,12 @@
2123

2224
## Install
2325

24-
It is recommended to use the latest [ngx_openresty bundle](http://openresty.org/) directly as this script (and its dependencies) depend on components that are installed by **openresty**.
26+
> **IMPORTANT**: **nginx-jwt** is a Lua script that is designed to run on Nginx servers that have the [HttpLuaModule](http://wiki.nginx.org/HttpLuaModule) installed. But ultimately its dependencies require components available in the [OpenResty](http://openresty.org/) distribution of Nginx. Therefore, it is recommended that you use **OpenResty** as your Nginx server, and these instructions make that assumption.
2527
2628
Install steps:
2729

28-
1. Build the Lua script dependencies using this command:
29-
30-
```bash
31-
./build deps
32-
```
33-
34-
This will create a local `lib/` directory that contains all Lua scripts that the **nginx-jwt** script depends on.
35-
36-
**NOTE**: This command should work on Mac OS as well as Ubuntu.
37-
38-
1. Deploy the [`nginx-jwt.lua`](nginx-jwt.lua) script as well as the local `lib/` directory (generated in the previous step) to one directory on your Nginx server.
30+
1. Download the latest archive package from [releases](releases).
31+
1. Extract the archive and deploy its contents to a directory on your Nginx server.
3932
1. Specify this directory's path using ngx_lua's [lua_package_path](https://github.com/openresty/lua-nginx-module#lua_package_path) directive:
4033
```lua
4134
# nginx.conf:
@@ -45,6 +38,9 @@ Install steps:
4538
...
4639
}
4740
```
41+
42+
## Configuration
43+
4844
1. Export the `JWT_SECRET` environment variable on the Nginx host, setting it equal to your JWT secret. Then expose it to Nginx server:
4945
```lua
5046
# nginx.conf:
@@ -388,6 +384,27 @@ All Node.js dependencies (npm packages) for tests are maintained in this [`packa
388384

389385
The proxy base Docker image may need to be updated periodically, usually to just rev the version of OpenResty that its using. This can be done by modifying the image's [`Dockerfile`](hosts/proxy/Dockerfile). Any change to this file will automatically result in new image builds when the `build` script is run.
390386

387+
## Packaging
388+
389+
When a new version of the script needs to be released, the following should be done:
390+
391+
> **NOTE**: These steps can only performed by GitHub users with commit access to the project.
392+
393+
1. Increment the [Semver](http://semver.org/) version in the [`version.txt`](version.txt) file as needed.
394+
1. Create a new git tag with the same version value (prefiexed with `v`):
395+
396+
```bash
397+
git tag v$(cat version.txt)
398+
```
399+
400+
1. Push the tag to GitHub.
401+
1. Create a new GitHub release in [releases](releases) that's associated with the above tag.
402+
1. Run the following command to create a release package archive and then upload it to the release created above:
403+
404+
```bash
405+
./build package
406+
```
407+
391408
## Issue Reporting
392409

393410
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.

build

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ else
1414
fi
1515

1616
# ensure a supported command
17-
commands=(run tests deps clean)
17+
commands=(run tests deps clean package)
1818
if [[ ! ${commands[*]} =~ "$command" ]]; then
1919
echo -e "${cyan}Unsupported command. Try:${no_color}"
2020
echo -e "run [NAME]: build and run backend and the specified proxy container and report back the proxy's URL"
2121
echo -e "tests: run the integration tests, building and running all necessary containers"
2222
echo -e "deps: build only Lua script dependencies"
2323
echo -e "clean: stop/delete all running containers and remove all images"
24+
echo -e "package: build a release package archive"
2425
fi
2526

2627
if [[ "$command" == "run" ]]; then
@@ -37,6 +38,20 @@ if [[ ${commands[*]} =~ "$command" ]]; then
3738
./scripts/build_deps.sh
3839
fi
3940

41+
if [[ "$command" == "package" ]]; then
42+
echo -e "${cyan}Building package archive for version:${no_color} $(cat version.txt)"
43+
archive=nginx-jwt.tar.gz
44+
if [ -f $archive ] ; then
45+
rm $archive
46+
fi
47+
48+
tar cvf $archive ./nginx-jwt.lua
49+
tar rvf $archive ./version.txt
50+
cd lib/
51+
tar rvf ../$archive ./
52+
cd ..
53+
fi
54+
4055
if [[ "$command" == "run" ]]; then
4156
# run backend container
4257
./scripts/run_backend.sh

scripts/build_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ load_dependency () {
2323
fi
2424
}
2525

26-
load_dependency "lib/resty/jwt.lua" "SkyLothar" "lua-resty-jwt" "b7976481061239ae2027e02be552b900bf25321c" "3fbc737d2a1defcdf372cab5f854182afbcede6e"
26+
load_dependency "lib/resty/jwt.lua" "SkyLothar" "lua-resty-jwt" "612dcf581b5dd2b4168bab67d017c5e23b32bf0a" "cca4f2ea1f49d7c12aecc46eb151cdf63c26294b"
2727
load_dependency "lib/resty/hmac.lua" "jkeys089" "lua-resty-hmac" "67bff3fd6b7ce4f898b4c3deec7a1f6050ff9fc9" "44dffa232bdf20e9cf13fb37c23df089e4ae1ee2"
2828
load_dependency "lib/basexx.lua" "aiq" "basexx" "514f46ceb9a8a867135856abf60aaacfd921d9b9" "da8efedf0d96a79a041eddfe45a6438ea4edf58b"

version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.1

0 commit comments

Comments
 (0)