Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt the plugin to kong v3.0.0 #211

Open
wants to merge 4 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
8 changes: 4 additions & 4 deletions kong-oidc-1.1.0-0.rockspec → kong-oidc-1.1.1-0.rockspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package = "kong-oidc"
version = "1.1.0-0"
version = "1.1.1-0"
source = {
url = "git://github.com/nokia/kong-oidc",
tag = "v1.1.0",
url = "git://github.com/hanfi/kong-oidc",
tag = "v1.1.1",
dir = "kong-oidc"
}
description = {
Expand All @@ -18,7 +18,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/hanfi/kong-oidc",
license = "Apache 2.0"
}
dependencies = {
Expand Down
14 changes: 4 additions & 10 deletions kong/plugins/oidc/handler.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
local BasePlugin = require "kong.plugins.base_plugin"
local OidcHandler = BasePlugin:extend()
local OidcHandler = {
PRIORITY = 1000,
VERSION = "1.1.1",
}
local utils = require("kong.plugins.oidc.utils")
local filter = require("kong.plugins.oidc.filter")
local session = require("kong.plugins.oidc.session")

OidcHandler.PRIORITY = 1000


function OidcHandler:new()
OidcHandler.super.new(self, "oidc")
end

function OidcHandler:access(config)
OidcHandler.super.access(self)
local oidcConfig = utils.get_options(config, ngx)

if filter.shouldProcessRequest(oidcConfig) then
Expand Down
47 changes: 28 additions & 19 deletions kong/plugins/oidc/schema.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
local typedefs = require "kong.db.schema.typedefs"

return {
no_consumer = true,
name = "oidc",
fields = {
client_id = { type = "string", required = true },
client_secret = { type = "string", required = true },
discovery = { type = "string", required = true, default = "https://.well-known/openid-configuration" },
introspection_endpoint = { type = "string", required = false },
timeout = { type = "number", required = false },
introspection_endpoint_auth_method = { type = "string", required = false },
bearer_only = { type = "string", required = true, default = "no" },
realm = { type = "string", required = true, default = "kong" },
redirect_uri_path = { type = "string" },
scope = { type = "string", required = true, default = "openid" },
response_type = { type = "string", required = true, default = "code" },
ssl_verify = { type = "string", required = true, default = "no" },
token_endpoint_auth_method = { type = "string", required = true, default = "client_secret_post" },
session_secret = { type = "string", required = false },
recovery_page_path = { type = "string" },
logout_path = { type = "string", required = false, default = '/logout' },
redirect_after_logout_uri = { type = "string", required = false, default = '/' },
filters = { type = "string" }
{ consumer = typedefs.no_consumer},
{ config = {
type = "record",
fields = {
{ client_id = { type = "string", required = true }, },
{ client_secret = { type = "string", required = true }, },
{ discovery = { type = "string", required = true, default = "https://.well-known/openid-configuration" }, },
{ introspection_endpoint = { type = "string", required = false }, },
{ timeout = { type = "number", required = false }, },
{ introspection_endpoint_auth_method = { type = "string", required = false }, },
{ bearer_only = { type = "string", required = true, default = "no" }, },
{ realm = { type = "string", required = true, default = "kong" }, },
{ redirect_uri_path = { type = "string" }, },
{ scope = { type = "string", required = true, default = "openid" }, },
{ response_type = { type = "string", required = true, default = "code" }, },
{ ssl_verify = { type = "string", required = true, default = "no" }, },
{ token_endpoint_auth_method = { type = "string", required = true, default = "client_secret_post" }, },
{ session_secret = { type = "string", required = false }, },
{ recovery_page_path = { type = "string" }, },
{ logout_path = { type = "string", required = false, default = '/logout' }, },
{ redirect_after_logout_uri = { type = "string", required = false, default = '/' }, },
{ filters = { type = "string" } },
}
}
}
}
}