aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ejabberd_option.erl8
-rw-r--r--src/ejabberd_options.erl17
2 files changed, 25 insertions, 0 deletions
diff --git a/src/ejabberd_option.erl b/src/ejabberd_option.erl
index a2855b1bf..030001ed8 100644
--- a/src/ejabberd_option.erl
+++ b/src/ejabberd_option.erl
@@ -15,6 +15,7 @@
-export([auth_cache_missed/0]).
-export([auth_cache_size/0]).
-export([auth_method/0, auth_method/1]).
+-export([auth_opts/0, auth_opts/1]).
-export([auth_password_format/0, auth_password_format/1]).
-export([auth_use_cache/0, auth_use_cache/1]).
-export([c2s_cafile/0, c2s_cafile/1]).
@@ -220,6 +221,13 @@ auth_method() ->
auth_method(Host) ->
ejabberd_config:get_option({auth_method, Host}).
+-spec auth_opts() -> [{any(),any()}].
+auth_opts() ->
+ auth_opts(global).
+-spec auth_opts(global | binary()) -> [{any(),any()}].
+auth_opts(Host) ->
+ ejabberd_config:get_option({auth_opts, Host}).
+
-spec auth_password_format() -> 'plain' | 'scram'.
auth_password_format() ->
auth_password_format(global).
diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl
index 3af793a91..e8b8cb890 100644
--- a/src/ejabberd_options.erl
+++ b/src/ejabberd_options.erl
@@ -62,6 +62,21 @@ opt_type(auth_cache_size) ->
econf:pos_int(infinity);
opt_type(auth_method) ->
econf:list_or_single(econf:db_type(ejabberd_auth));
+opt_type(auth_opts) ->
+ fun(L) when is_list(L) ->
+ lists:map(
+ fun({host, V}) when is_binary(V) ->
+ {host, V};
+ ({connection_pool_size, V}) when is_integer(V) ->
+ {connection_pool_size, V};
+ ({connection_opts, V}) when is_list(V) ->
+ {connection_opts, V};
+ ({basic_auth, V}) when is_binary(V) ->
+ {basic_auth, V};
+ ({path_prefix, V}) when is_binary(V) ->
+ {path_prefix, V}
+ end, L)
+ end;
opt_type(auth_password_format) ->
econf:enum([plain, scram]);
opt_type(auth_use_cache) ->
@@ -443,6 +458,7 @@ opt_type(jwt_auth_only_rule) ->
{disable_sasl_mechanisms, [binary()]} |
{s2s_zlib, boolean()} |
{loglevel, ejabberd_logger:loglevel()} |
+ {auth_opts, [{any(), any()}]} |
{listen, [ejabberd_listener:listener()]} |
{modules, [{module(), gen_mod:opts(), integer()}]} |
{ldap_uids, [{binary(), binary()}]} |
@@ -493,6 +509,7 @@ options() ->
fun(Host) -> ejabberd_config:get_option({cache_size, Host}) end},
{auth_method,
fun(Host) -> [ejabberd_config:default_db(Host, ejabberd_auth)] end},
+ {auth_opts, []},
{auth_password_format, plain},
{auth_use_cache,
fun(Host) -> ejabberd_config:get_option({use_cache, Host}) end},