Skip to content

Commit

Permalink
Fix expiration date calculation in mod_auth_fast
Browse files Browse the repository at this point in the history
  • Loading branch information
prefiks committed Dec 17, 2024
1 parent beb5bfe commit 3dd7feb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mod_auth_fast.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down Expand Up @@ -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) ->
Expand Down

0 comments on commit 3dd7feb

Please sign in to comment.