chore: bind_as_user set default value
This commit is contained in:
parent
46d0cb69dc
commit
8b4b9a119b
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_ldap,
|
{application, emqx_auth_ldap,
|
||||||
[{description, "EMQ X Authentication/ACL with LDAP"},
|
[{description, "EMQ X Authentication/ACL with LDAP"},
|
||||||
{vsn, "4.3.1"}, % strict semver, bump manually!
|
{vsn, "4.3.2"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_auth_ldap_sup]},
|
{registered, [emqx_auth_ldap_sup]},
|
||||||
{applications, [kernel,stdlib,eldap2,ecpool]},
|
{applications, [kernel,stdlib,eldap2,ecpool]},
|
||||||
|
|
|
@ -1,8 +1,22 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*-: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[ {"4.3.0",
|
[ {"4.3.0",
|
||||||
[{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
|
||||||
{<<".*">>,[]}],
|
, {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
|
||||||
[{"4.3.0",
|
]},
|
||||||
[{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
{"4.3.1",
|
||||||
{<<".*">>,[]}]}.
|
[ {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
|
||||||
|
]},
|
||||||
|
{<<".*">>, []}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{"4.3.0",
|
||||||
|
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
|
||||||
|
, {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
|
||||||
|
]},
|
||||||
|
{"4.3.1",
|
||||||
|
[ {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
|
||||||
|
]},
|
||||||
|
{<<".*">>, []}
|
||||||
|
]
|
||||||
|
}.
|
||||||
|
|
|
@ -76,8 +76,8 @@ connect(Opts) ->
|
||||||
search(Pool, Base, Filter) ->
|
search(Pool, Base, Filter) ->
|
||||||
ecpool:with_client(Pool,
|
ecpool:with_client(Pool,
|
||||||
fun(C) ->
|
fun(C) ->
|
||||||
case application:get_env(?APP, bind_as_user) of
|
case application:get_env(?APP, bind_as_user, false) of
|
||||||
{ok, true} ->
|
true ->
|
||||||
{ok, Opts} = application:get_env(?APP, ldap),
|
{ok, Opts} = application:get_env(?APP, ldap),
|
||||||
BindDn = get_value(bind_dn, Opts),
|
BindDn = get_value(bind_dn, Opts),
|
||||||
BindPassword = get_value(bind_password, Opts),
|
BindPassword = get_value(bind_password, Opts),
|
||||||
|
@ -91,7 +91,7 @@ search(Pool, Base, Filter) ->
|
||||||
catch
|
catch
|
||||||
error:Reason -> {error, Reason}
|
error:Reason -> {error, Reason}
|
||||||
end;
|
end;
|
||||||
{ok, false} ->
|
false ->
|
||||||
eldap2:search(C, [{base, Base},
|
eldap2:search(C, [{base, Base},
|
||||||
{filter, Filter},
|
{filter, Filter},
|
||||||
{deref, eldap2:derefFindingBaseObj()}])
|
{deref, eldap2:derefFindingBaseObj()}])
|
||||||
|
@ -101,8 +101,8 @@ search(Pool, Base, Filter) ->
|
||||||
search(Pool, Base, Filter, Attributes) ->
|
search(Pool, Base, Filter, Attributes) ->
|
||||||
ecpool:with_client(Pool,
|
ecpool:with_client(Pool,
|
||||||
fun(C) ->
|
fun(C) ->
|
||||||
case application:get_env(?APP, bind_as_user) of
|
case application:get_env(?APP, bind_as_user, false) of
|
||||||
{ok, true} ->
|
true ->
|
||||||
{ok, Opts} = application:get_env(?APP, ldap),
|
{ok, Opts} = application:get_env(?APP, ldap),
|
||||||
BindDn = get_value(bind_dn, Opts),
|
BindDn = get_value(bind_dn, Opts),
|
||||||
BindPassword = get_value(bind_password, Opts),
|
BindPassword = get_value(bind_password, Opts),
|
||||||
|
@ -117,7 +117,7 @@ search(Pool, Base, Filter, Attributes) ->
|
||||||
catch
|
catch
|
||||||
error:Reason -> {error, Reason}
|
error:Reason -> {error, Reason}
|
||||||
end;
|
end;
|
||||||
{ok, false} ->
|
false ->
|
||||||
eldap2:search(C, [{base, Base},
|
eldap2:search(C, [{base, Base},
|
||||||
{filter, Filter},
|
{filter, Filter},
|
||||||
{attributes, Attributes},
|
{attributes, Attributes},
|
||||||
|
|
Loading…
Reference in New Issue