File

teal-src/core/usermanager.d.tl @ 12938:055b03d3059b

util.sasl.oauthbearer: Return username from callback instead using authzid (BC) RFC 6120 states that > If the initiating entity does not wish to act on behalf of another > entity, it MUST NOT provide an authorization identity. Thus it seems weird to require it here. We can instead expect an username from the token data passed back from the profile. This follows the practice of util.sasl.external where the profile callback returns the selected username, making the authentication module responsible for extracting the username from the token.
author Kim Alvefur <zash@zash.se>
date Thu, 16 Mar 2023 12:18:23 +0100
parent 12905:8473a516004f
line wrap: on
line source

local Role = require "util.roles".Role;

local record usermanager
	record AuthProvider
		-- TODO
	end
	record AccountInfo
		created : number
		password_updated : any
		enabled : boolean
	end

	-- Users
	test_password : function (username : string, host : string, password : string) : boolean
	get_password : function (username : string, host : string) : string, string
	set_password : function (username : string, host : string, password : string) : boolean, string
	get_account_info : function (username : string, host : string) : AccountInfo
	user_exists : function (username : string, host : string) : boolean
	create_user : function (username : string, password : string, host : string) : boolean, string
	delete_user : function (username : string, host : string) : boolean, string
	user_is_enabled : function (username : string, host : string) : boolean, string
	enable_user : function (username : string, host : string) : boolean, string
	disable_user : function (username : string, host : string) : boolean, string
	users : function (host : string) : function () : string

	-- Roles
	get_user_role : function (username : string, host : string) : Role
	set_user_role : function (username : string, host : string, role_name : string) : boolean, string
	user_can_assume_role : function (username : string, host : string, role_name : string) : boolean
	add_user_secondary_role : function (username : string, host: string, role_name : string) : boolean, string
	remove_user_secondary_role : function (username : string, host: string, role_name : string) : boolean, string
	get_user_secondary_roles : function (username : string, host : string) : { string : Role }
	get_users_with_role : function (role : string, host : string) : { string }
	get_jid_role : function (jid : string, host : string) : Role
	set_jid_role : function (jid : string, host : string, role_name : string) : boolean
	get_jids_with_role : function (role : string, host : string) : { string }
	get_role_by_name : function (role_name : string) : Role

	-- Etc
	get_provider : function (host : string) : AuthProvider
	get_sasl_handler : function (host : string, session : table) : table
	initialize_host : function (host : string)
	new_null_provider : function () : AuthProvider
end

return usermanager