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

perf(oauth2) remove needless use of regex for artificial endpoints #2806

Merged
merged 1 commit into from
Aug 18, 2017
Merged
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
13 changes: 3 additions & 10 deletions kong/plugins/oauth2/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -528,22 +528,15 @@ function _M.execute(conf)
end

if ngx.req.get_method() == "POST" then
local uri = ngx.var.uri

local from, _, err = ngx.re.find(ngx.var.uri, [[\/oauth2\/token]], "oj")
if err then
ngx.log(ngx.ERR, "could not search for token path segment: ", err)
return
end
local from, _ = string_find(uri, "/oauth2/token", nil, true)

if from then
issue_token(conf)

else
from, _, err = ngx.re.find(ngx.var.uri, [[\/oauth2\/authorize]], "oj")
if err then
ngx.log(ngx.ERR, "could not search for authorize path segment: ", err)
return
end
from, _ = string_find(uri, "/oauth2/authorize", nil, true)

if from then
authorize(conf)
Expand Down