Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

make secrets fields referenceable to be handle by vault secret management #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions kong-oidc.rockspec → kong-plugin-oidc-1.4.0-1.rockspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package = "kong-oidc"
package = "kong-plugin-oidc"
version = "1.4.0-1"
source = {
url = "git://github.com/revomatico/kong-oidc",
tag = "master",
dir = "kong-oidc"
url = "git://github.com/revomatico/kong-oidc.git",
tag = "master"
}
description = {
summary = "A Kong plugin for implementing the OpenID Connect Relying Party (RP) functionality",
Expand All @@ -18,7 +17,7 @@ description = {

It can be used as a reverse proxy terminating OAuth/OpenID Connect in front of an origin server so that the origin server/services can be protected with the relevant standards without implementing those on the server itself.
]],
homepage = "https://github.com/nokia/kong-oidc",
homepage = "https://github.com/revomatico/kong-oidc",
license = "Apache 2.0"
}
dependencies = {
Expand All @@ -27,10 +26,10 @@ dependencies = {
build = {
type = "builtin",
modules = {
["kong.plugins.oidc.filter"] = "kong/plugins/oidc/filter.lua",
["kong.plugins.oidc.handler"] = "kong/plugins/oidc/handler.lua",
["kong.plugins.oidc.schema"] = "kong/plugins/oidc/schema.lua",
["kong.plugins.oidc.session"] = "kong/plugins/oidc/session.lua",
["kong.plugins.oidc.utils"] = "kong/plugins/oidc/utils.lua"
["kong.plugins.oidc.filter"] = "kong/plugins/oidc/filter.lua",
["kong.plugins.oidc.handler"] = "kong/plugins/oidc/handler.lua",
["kong.plugins.oidc.schema"] = "kong/plugins/oidc/schema.lua",
["kong.plugins.oidc.session"] = "kong/plugins/oidc/session.lua",
["kong.plugins.oidc.utils"] = "kong/plugins/oidc/utils.lua"
}
}
4 changes: 3 additions & 1 deletion kong/plugins/oidc/handler.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local OidcHandler = {
VERSION = "1.3.0",
VERSION = "1.4.0",
PRIORITY = 1000,
}
local utils = require("kong.plugins.oidc.utils")
Expand Down Expand Up @@ -95,6 +95,7 @@ function make_oidc(oidcConfig)
local res, err = require("resty.openidc").authenticate(oidcConfig, ngx.var.request_uri, unauth_action)

if err then
kong.log.err("Authentication failed: " .. err)
if err == 'unauthorized request' then
return kong.response.error(ngx.HTTP_UNAUTHORIZED)
else
Expand All @@ -117,6 +118,7 @@ function introspect(oidcConfig)
res, err = require("resty.openidc").introspect(oidcConfig)
end
if err then
kong.log.err("Introspect failed: " .. err)
if oidcConfig.bearer_only == "yes" then
ngx.header["WWW-Authenticate"] = 'Bearer realm="' .. oidcConfig.realm .. '",error="' .. err .. '"'
return kong.response.error(ngx.HTTP_UNAUTHORIZED)
Expand Down
9 changes: 6 additions & 3 deletions kong/plugins/oidc/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ return {
{
client_id = {
type = "string",
required = true
required = true,
referenceable = true
}
},
{
client_secret = {
type = "string",
required = true
required = true,
referenceable = true
}
},
{
Expand Down Expand Up @@ -123,7 +125,8 @@ return {
{
session_secret = {
type = "string",
required = false
required = false,
referenceable = true
}
},
{
Expand Down