./ct_report/coverage/mod_auth_token_backend.COVER.html

1 %%%----------------------------------------------------------------------
2 %%% @copyright 2021, Erlang Solutions Ltd.
3 %%% @doc A proxy interface module between the main mod_auth_token
4 %%% module and the backend modules.
5 %%% @end
6 %%%----------------------------------------------------------------------
7 -module(mod_auth_token_backend).
8 -export([start/2,
9 revoke/2,
10 get_valid_sequence_number/2,
11 clean_tokens/2]).
12
13 -define(MAIN_MODULE, mod_auth_token).
14
15 %% ----------------------------------------------------------------------
16 %% Callbacks
17
18 -callback start(mongooseim:host_type()) -> ok.
19
20 -callback revoke(mongooseim:host_type(), jid:jid()) -> ok | not_found.
21
22 -callback get_valid_sequence_number(mongooseim:host_type(), jid:jid()) -> integer().
23
24 -callback clean_tokens(mongooseim:host_type(), jid:jid()) -> ok.
25
26 %% ----------------------------------------------------------------------
27 %% API Functions
28
29 -spec start(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
30 start(HostType, Opts) ->
31 6 mongoose_backend:init(HostType, ?MAIN_MODULE, [], Opts),
32 6 Args = [HostType],
33 6 mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
34
35 -spec revoke(mongooseim:host_type(), jid:jid()) -> ok | not_found.
36 revoke(HostType, JID) ->
37 12 Args = [HostType, JID],
38 12 mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
39
40 -spec get_valid_sequence_number(mongooseim:host_type(), jid:jid()) -> integer().
41 get_valid_sequence_number(HostType, JID) ->
42 25 Args = [HostType, JID],
43 25 mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
44
45 -spec clean_tokens(mongooseim:host_type(), jid:jid()) -> ok.
46 clean_tokens(HostType, JID) ->
47 30 Args = [HostType, JID],
48 30 mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
Line Hits Source