Skip to content

Commit

Permalink
Fixing mod_auth_token
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Jakubiec authored and Janusz Jakubiec committed Jul 25, 2022
1 parent b0d639f commit bfc72f9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/mod_auth_token.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
-export([deserialize/1,
serialize/1]).

%% Command-line interface
-export([revoke_token_command/1]).

%% Test only!
-export([datetime_to_seconds/1,
seconds_to_datetime/1]).
Expand Down Expand Up @@ -130,7 +133,7 @@ validity_period_spec() ->
commands() ->
[#ejabberd_commands{ name = revoke_token, tags = [tokens],
desc = "Revoke REFRESH token",
module = mod_auth_token_api, function = revoke_token_command,
module = ?MODULE, function = revoke_token_command,
args = [{owner, binary}], result = {res, restuple} }].

%%
Expand Down Expand Up @@ -412,6 +415,16 @@ key_name(access) -> token_secret;
key_name(refresh) -> token_secret;
key_name(provision) -> provision_pre_shared.

-spec revoke_token_command(Owner) -> ResTuple when
Owner :: binary(),
ResCode :: ok | not_found | error,
ResTuple :: {ResCode, string()}.
revoke_token_command(Owner) ->
case mod_auth_token_api:revoke_token_command(Owner) of
{ok, _} = Result -> Result;
{error, Error} -> Error
end.

-spec clean_tokens(mongoose_acc:t(), User :: jid:user(), Server :: jid:server()) ->
mongoose_acc:t().
clean_tokens(Acc, User, Server) ->
Expand Down

0 comments on commit bfc72f9

Please sign in to comment.