Skip to content

Commit bd3de58

Browse files
committed
url-encode client_id/client_secret; closes #204 and #205
conforming to: https://tools.ietf.org/html/rfc6749#section-2.3.1 thanks @grrolland Signed-off-by: Hans Zandbelt <[email protected]>
1 parent e5e1987 commit bd3de58

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
10/11/2018
2+
- url-encode client_id/client_secret; closes #204 and #205; thanks @grrolland
3+
https://tools.ietf.org/html/rfc6749#section-2.3.1
4+
15
10/8/2018
26
- make call_token_endpoint a public function
37

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ http {
118118
-- and could not set the hostname
119119
120120
discovery = "https://accounts.google.com/.well-known/openid-configuration",
121+
-- For non compliant OPs to OAuth 2.0 RFC 6749 for client Authentication (cf. https://tools.ietf.org/html/rfc6749#section-2.3.1)
122+
-- client_id and client_secret MUST be invariant when url encoded
121123
client_id = "<client_id>",
122-
client_secret = "<client_secret>"
124+
client_secret = "<client_secret>",
125+
123126
--authorization_params = { hd="zmartzone.eu" },
124127
--scope = "openid email profile",
125128
-- Refresh the users id_token after 900 seconds without requiring re-authentication

lib/resty/openidc.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function openidc.call_token_endpoint(opts, endpoint, body, auth, endpoint_name)
391391
if auth then
392392
if auth == "client_secret_basic" then
393393
if opts.client_secret then
394-
headers.Authorization = "Basic " .. b64(opts.client_id .. ":" .. opts.client_secret)
394+
headers.Authorization = "Basic " .. b64(ngx.escape_uri(opts.client_id) .. ":" .. ngx.escape_uri(opts.client_secret))
395395
else
396396
-- client_secret must not be set if Windows Integrated Authentication (WIA) is used with
397397
-- Active Directory Federation Services (AD FS) 4.0 (or newer) on Windows Server 2016 (or newer)

0 commit comments

Comments
 (0)