Changeset

5442:7480dde4cd2e

mod_auth_oauth_external: Stub not implemented auth module methods Not providing some of these may trigger errors on use, which is something that would be nice to fix on the Prosody side, one day.
author Kim Alvefur <zash@zash.se>
date Wed, 10 May 2023 19:11:25 +0200
parents 5441:533808db6c18
children 5443:4e79f344ae2f
files mod_auth_oauth_external/mod_auth_oauth_external.lua
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_oauth_external/mod_auth_oauth_external.lua	Wed May 10 18:32:47 2023 +0200
+++ b/mod_auth_oauth_external/mod_auth_oauth_external.lua	Wed May 10 19:11:25 2023 +0200
@@ -30,6 +30,32 @@
 local host = module.host;
 local provider = {};
 
+local function not_implemented()
+	return nil, "method not implemented"
+end
+
+-- With proper OAuth 2, most of these should be handled at the atuhorization
+-- server, no there.
+provider.test_password = not_implemented;
+provider.get_password = not_implemented;
+provider.set_password = not_implemented;
+provider.create_user = not_implemented;
+provider.delete_user = not_implemented;
+
+function provider.user_exists(_username)
+	-- Can this even be done in a generic way in OAuth 2?
+	-- OIDC and WebFinger perhaps?
+	return true;
+end
+
+function provider.users()
+	-- TODO this could be done by recording known users locally
+	return function ()
+		module:log("debug", "User iteration not supported");
+		return nil;
+	end
+end
+
 function provider.get_sasl_handler()
 	local profile = {};
 	profile.http_client = http.default; -- TODO configurable