Skip to content

Commit

Permalink
Merge 713f2d2 into f4d9ed9
Browse files Browse the repository at this point in the history
  • Loading branch information
Trojan295 committed Apr 1, 2018
2 parents f4d9ed9 + 713f2d2 commit fefc69c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# emacs
*~
\#*\#
.\#*
.\#*
lua_install
luacov.stats.out
5 changes: 5 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
return {
["include"] = {
'kong/plugins/oidc'
},
}
27 changes: 5 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,13 @@ language: python
sudo: false

env:
- LUA="lua=5.1"
# - LUA="lua=5.2"
# - LUA="lua=5.3"
# - LUA="luajit=2.0"
# - LUA="luajit=2.1"

before_install:
- pip install hererocks
- hererocks lua_install -r^ --$LUA
- export PATH=$PATH:$PWD/lua_install/bin

install:
- luarocks install kong 0.11.2-0
- luarocks install lua-resty-openidc 1.4.0-1
- luarocks install luaunit
- luarocks install luacov-coveralls
- LUA_VERSION="5.1" KONG_VERSION="0.13.0-0" LUA_RESTY_OPENIDC_VERSION="1.5.3"
- LUA_VERSION="5.1" KONG_VERSION="0.12.3-0" LUA_RESTY_OPENIDC_VERSION="1.5.3"
- LUA_VERSION="5.1" KONG_VERSION="0.11.2-0" LUA_RESTY_OPENIDC_VERSION="1.5.3"

script:
- lua -lluacov test/unit/test_filter.lua -o TAP --failure
- lua -lluacov test/unit/test_filters_advanced.lua -o TAP --failure
- lua -lluacov test/unit/test_utils.lua -o TAP --failure
- lua -lluacov test/unit/test_handler_mocking_openidc.lua --failure
- lua -lluacov test/unit/test_introspect.lua -o TAP --failure
- lua -lluacov test/unit/test_utils_bearer_access_token.lua -o TAP --failure
- source ci/run.sh

after_success:
- luarocks install luacov-coveralls
- luacov-coveralls
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ You also need to set the `KONG_CUSTOM_PLUGINS` environment variable
| `config.introspection_endpoint` | | false | Token introspection endpoint |
| `config.bearer_only` | no | false | Only introspect tokens without redirecting |
| `config.realm` | kong | false | Realm used in WWW-Authenticate response header |

| `config.logout_path` | /logout | false | Absolute path used to logout from the OIDC RP |

### Enabling

Expand Down Expand Up @@ -154,3 +154,14 @@ Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: session=KOn1am4mhQLKazlCA.....
X-Userinfo: {"preferred_username":"alice","id":"60f65308-3510-40ca-83f0-e9c0151cc680","sub":"60f65308-3510-40ca-83f0-e9c0151cc680"}
```


## Development

### Run CI locally

To run the CI locally you can use the following command:

```
docker run --rm -it -v `pwd`:/app --workdir=/app python bash ci/run.sh
```
25 changes: 25 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

export LUA_VERSION=${LUA_VERSION:-5.1}
export KONG_VERSION=${KONG_VERSION:-0.11.2-0}
export LUA_RESTY_OPENIDC_VERSION=${LUA_RESTY_OPENIDC_VERSION:-1.5.3}

apt-get update
apt-get install -y unzip

pip install hererocks
hererocks lua_install -r^ --lua=${LUA_VERSION}
export PATH=${PATH}:${PWD}/lua_install/bin

luarocks install kong ${KONG_VERSION}
luarocks install lua-resty-openidc ${LUA_RESTY_OPENIDC_VERSION}
luarocks install lua-cjson
luarocks install luaunit
luarocks install luacov

lua -lluacov test/unit/test_filter.lua -o TAP --failure
lua -lluacov test/unit/test_filters_advanced.lua -o TAP --failure
lua -lluacov test/unit/test_utils.lua -o TAP --failure
lua -lluacov test/unit/test_handler_mocking_openidc.lua --failure
lua -lluacov test/unit/test_introspect.lua -o TAP --failure
lua -lluacov test/unit/test_utils_bearer_access_token.lua -o TAP --failure
4 changes: 2 additions & 2 deletions kong-oidc-1.0.4-0.rockspec → kong-oidc-1.0.5-0.rockspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package = "kong-oidc"
version = "1.0.4-0"
version = "1.0.5-0"
source = {
url = "git://github.com/nokia/kong-oidc",
tag = "v1.0.4",
tag = "v1.0.5",
dir = "kong-oidc"
}
description = {
Expand Down
1 change: 1 addition & 0 deletions kong/plugins/oidc/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ return {
introspection_endpoint = { type = "string", required = false },
bearer_only = { type = "string", required = true, default = "no" },
realm = { type = "string", required = true, default = "kong" },
logout_path = { type = "string", required = false, default = '/logout' },
redirect_uri_path = { type = "string" },
scope = { type = "string", required = true, default = "openid" },
response_type = { type = "string", required = true, default = "code" },
Expand Down
3 changes: 2 additions & 1 deletion kong/plugins/oidc/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function M.get_options(config, ngx)
ssl_verify = config.ssl_verify,
token_endpoint_auth_method = config.token_endpoint_auth_method,
recovery_page_path = config.recovery_page_path,
filters = parseFilters(config.filters)
filters = parseFilters(config.filters),
logout_path = config.logout_path,
}
end

Expand Down
4 changes: 3 additions & 1 deletion test/unit/test_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function TestUtils:testOptions()
response_type = "code",
ssl_verify = "no",
token_endpoint_auth_method = "client_secret_post",
filters = "pattern1,pattern2,pattern3"
filters = "pattern1,pattern2,pattern3",
logout_path = "/logout"

}, {var = {request_uri = "/path"},
req = {get_uri_args = function() return nil end}})
Expand All @@ -47,6 +48,7 @@ function TestUtils:testOptions()
lu.assertEquals(opts.ssl_verify, "no")
lu.assertEquals(opts.token_endpoint_auth_method, "client_secret_post")
lu.assertEquals(opts.redirect_uri_path, "/path/")
lu.assertEquals(opts.logout_path, "/logout")

local expectedFilters = {
"pattern1",
Expand Down

0 comments on commit fefc69c

Please sign in to comment.