changeset 5201:47576c73eedf

mod_http_oauth2: Strip trailing '/' from issuer URL
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Mar 2023 13:23:26 +0000
parents afed7d5bd65c
children b81fd0d22c66
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Fri Mar 03 22:54:46 2023 +0100
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Sat Mar 04 13:23:26 2023 +0000
@@ -156,7 +156,7 @@
 	local query = http.formdecode(redirect.query or "");
 	if type(query) ~= "table" then query = {}; end
 	table.insert(query, { name = "code", value = code });
-	table.insert(query, { name = "iss", value = module:http_url(nil, "/") });
+	table.insert(query, { name = "iss", value = module:http_url(nil, "/"):gsub("/$", "") });
 	if params.state then
 		table.insert(query, { name = "state", value = params.state });
 	end
@@ -468,7 +468,7 @@
 		["GET"] = {
 			headers = { content_type = "application/json" };
 			body = json.encode {
-				issuer = module:http_url(nil, "/");
+				issuer = module:http_url(nil, "/"):gsub("/$", "");
 				authorization_endpoint = handle_authorization_request and module:http_url() .. "/authorize" or nil;
 				token_endpoint = handle_token_grant and module:http_url() .. "/token" or nil;
 				jwks_uri = nil; -- TODO?