fix(ldap): fix license date and some minor problems
This commit is contained in:
parent
1b0b15786c
commit
7055eafb91
|
@ -19,7 +19,8 @@
|
||||||
-export([
|
-export([
|
||||||
hash/2,
|
hash/2,
|
||||||
hash_data/2,
|
hash_data/2,
|
||||||
check_pass/3
|
check_pass/3,
|
||||||
|
compare_secure/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export_type([
|
-export_type([
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_authn_enterprise).
|
-module(emqx_authn_enterprise).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ldap_authn).
|
-module(emqx_ldap_authn).
|
||||||
|
@ -47,7 +47,7 @@ tags() ->
|
||||||
|
|
||||||
%% used for config check when the schema module is resolved
|
%% used for config check when the schema module is resolved
|
||||||
roots() ->
|
roots() ->
|
||||||
[{?CONF_NS, hoconsc:mk(hoconsc:ref(?MODULE, mysql))}].
|
[{?CONF_NS, hoconsc:mk(hoconsc:ref(?MODULE, ldap))}].
|
||||||
|
|
||||||
fields(ldap) ->
|
fields(ldap) ->
|
||||||
[
|
[
|
||||||
|
@ -73,7 +73,7 @@ is_superuser_attribute(desc) -> ?DESC(?FUNCTION_NAME);
|
||||||
is_superuser_attribute(default) -> <<"isSuperuser">>;
|
is_superuser_attribute(default) -> <<"isSuperuser">>;
|
||||||
is_superuser_attribute(_) -> undefined.
|
is_superuser_attribute(_) -> undefined.
|
||||||
|
|
||||||
query_timeout(type) -> emqx_schema:duration_ms();
|
query_timeout(type) -> emqx_schema:timeout_duration_ms();
|
||||||
query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
|
query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
|
||||||
query_timeout(default) -> <<"5s">>;
|
query_timeout(default) -> <<"5s">>;
|
||||||
query_timeout(_) -> undefined.
|
query_timeout(_) -> undefined.
|
||||||
|
@ -173,7 +173,7 @@ ensure_password(
|
||||||
undefined ->
|
undefined ->
|
||||||
{error, no_password};
|
{error, no_password};
|
||||||
[LDAPPassword | _] ->
|
[LDAPPassword | _] ->
|
||||||
extract_hash_algorithm(LDAPPassword, Password, fun try_decode_passowrd/4, Entry, State)
|
extract_hash_algorithm(LDAPPassword, Password, fun try_decode_password/4, Entry, State)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% RFC 2307 format password
|
%% RFC 2307 format password
|
||||||
|
@ -207,7 +207,7 @@ is_valid_algorithm(HashType, PasswordHash, Password, Entry, State) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% this password is in LDIF format which is base64 encoding
|
%% this password is in LDIF format which is base64 encoding
|
||||||
try_decode_passowrd(LDAPPassword, Password, Entry, State) ->
|
try_decode_password(LDAPPassword, Password, Entry, State) ->
|
||||||
case safe_base64_decode(LDAPPassword) of
|
case safe_base64_decode(LDAPPassword) of
|
||||||
{ok, Decode} ->
|
{ok, Decode} ->
|
||||||
extract_hash_algorithm(
|
extract_hash_algorithm(
|
||||||
|
@ -279,9 +279,7 @@ hash_password(Algorithm, Salt, suffix, Password) ->
|
||||||
hash_password(Algorithm, Data) ->
|
hash_password(Algorithm, Data) ->
|
||||||
crypto:hash(Algorithm, Data).
|
crypto:hash(Algorithm, Data).
|
||||||
|
|
||||||
compare_password(hash, PasswordHash, PasswordHash) ->
|
compare_password(hash, LDAPPasswordHash, PasswordHash) ->
|
||||||
true;
|
emqx_passwd:compare_secure(LDAPPasswordHash, PasswordHash);
|
||||||
compare_password(base64, Base64HashData, PasswordHash) ->
|
compare_password(base64, Base64HashData, PasswordHash) ->
|
||||||
Base64HashData =:= base64:encode(PasswordHash);
|
emqx_passwd:compare_secure(Base64HashData, base64:encode(PasswordHash)).
|
||||||
compare_password(_, _, _) ->
|
|
||||||
false.
|
|
||||||
|
|
|
@ -27,5 +27,5 @@ dn : {token, {dn, TokenLine}}.
|
||||||
Erlang code.
|
Erlang code.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Header "%%--------------------------------------------------------------------
|
Header "%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------".
|
%%--------------------------------------------------------------------".
|
||||||
|
|
||||||
Nonterminals
|
Nonterminals
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ldap_SUITE).
|
-module(emqx_ldap_SUITE).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ldap_authn_SUITE).
|
-module(emqx_ldap_authn_SUITE).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ldap_filter_SUITE).
|
-module(emqx_ldap_filter_SUITE).
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Integrated the LDAP as a new authenticator.
|
Integrated LDAP as a new authenticator.
|
||||||
|
|
Loading…
Reference in New Issue