25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Fix expiration date calculation in mod_auth_fast

This commit is contained in:
Paweł Chmielowski 2024-12-17 13:28:54 +01:00
parent beb5bfea36
commit 3dd7febb98

View File

@ -86,8 +86,8 @@ mod_opt_type(token_refresh_age) ->
-spec mod_options(binary()) -> [{atom(), any()}].
mod_options(Host) ->
[{db_type, ejabberd_config:default_db(Host, ?MODULE)},
{token_lifetime, timer:hours(30*24)},
{token_refresh_age, timer:hours(24)}].
{token_lifetime, 30*24*60*60},
{token_refresh_age, 2*60*605}].
mod_doc() ->
#{desc =>
@ -136,7 +136,7 @@ gen_token(#{sasl2_ua_id := UA, server := Server, user := User}) ->
Token = base64:encode(ua_hash(<<UA/binary, (p1_rand:get_string())/binary>>)),
ExpiresAt = erlang:system_time(second) + mod_auth_fast_opt:token_lifetime(Server),
Mod:set_token(Server, User, ua_hash(UA), next, Token, ExpiresAt),
#fast_token{token = Token, expiry = misc:usec_to_now(ExpiresAt)}.
#fast_token{token = Token, expiry = misc:usec_to_now(ExpiresAt*1000000)}.
c2s_handle_sasl2_inline({#{server := Server, user := User, sasl2_ua_id := UA,
sasl2_axtra_auth_info := Extra} = State, Els, Results} = Acc) ->