Skip to content

Commit 55946ba

Browse files
committed
release 1.3.1: avoid crash if no session exists on redirect_uri access
may address #43; thanks @venkatmarepalli and @bungle Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 144b965 commit 55946ba

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sudo: false
44

55
env:
66
global:
7-
- VERSION=1.3.0-2
7+
- VERSION=1.3.1-1
88
- NAME=lua-resty-openidc
99
- ROCKSPEC=$NAME-$VERSION.rockspec
1010
- LUAROCKS=2.3.0

Diff for: ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
03/27/2017
2+
- avoid crashes when no session is found upon callback to the redirect_uri; may address #43
3+
- release 1.3.1
4+
15
02/28/2017
26
- add dist.ini for OpenResty OPM; should address #38
37

Diff for: lib/resty/openidc.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ local type = type
5757
local ngx = ngx
5858

5959
local openidc = {
60-
_VERSION = "1.3.0"
60+
_VERSION = "1.3.1"
6161
}
6262
openidc.__index = openidc
6363

@@ -556,6 +556,11 @@ function openidc.authenticate(opts, target_url)
556556
-- see if this is a request to the redirect_uri i.e. an authorization response
557557
local path = target_url:match("(.-)%?") or target_url
558558
if path == opts.redirect_uri_path then
559+
if not session.present then
560+
err = "request to the redirect_uri_path but there's no session state found"
561+
ngx.log(ngx.ERR, err)
562+
return nil, err, target_url
563+
end
559564
return openidc_authorization_response(opts, session)
560565
end
561566

@@ -565,7 +570,7 @@ function openidc.authenticate(opts, target_url)
565570
end
566571

567572
-- if we have no id_token then redirect to the OP for authentication
568-
if not session.data.id_token then
573+
if not session.present or not session.data.id_token then
569574
return openidc_authorize(opts, session, target_url)
570575
end
571576

Diff for: lua-resty-openidc-1.3.0-2.rockspec renamed to lua-resty-openidc-1.3.1-1.rockspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package = "lua-resty-openidc"
2-
version = "1.3.0-2"
2+
version = "1.3.1-1"
33
source = {
44
url = "git://github.com/pingidentity/lua-resty-openidc",
5-
tag = "v1.3.0",
5+
tag = "v1.3.1",
66
dir = "lua-resty-openidc"
77
}
88
description = {

0 commit comments

Comments
 (0)