-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3336 from esl/wdbm-mod_auth_token
Add `mod_auth_token_backend`
- Loading branch information
Showing
7 changed files
with
71 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
%%%---------------------------------------------------------------------- | ||
%%% @copyright 2021, Erlang Solutions Ltd. | ||
%%% @doc A proxy interface module between the main mod_auth_token | ||
%%% module and the backend modules. | ||
%%% @end | ||
%%%---------------------------------------------------------------------- | ||
-module(mod_auth_token_backend). | ||
-export([start/1, | ||
revoke/2, | ||
get_valid_sequence_number/2, | ||
clean_tokens/2]). | ||
|
||
-define(MAIN_MODULE, mod_auth_token). | ||
|
||
%% ---------------------------------------------------------------------- | ||
%% Callbacks | ||
|
||
-callback start(mongooseim:host_type()) -> ok. | ||
|
||
-callback revoke(mongooseim:host_type(), jid:jid()) -> ok | not_found. | ||
|
||
-callback get_valid_sequence_number(mongooseim:host_type(), jid:jid()) -> integer(). | ||
|
||
-callback clean_tokens(mongooseim:host_type(), jid:jid()) -> ok. | ||
|
||
%% ---------------------------------------------------------------------- | ||
%% API Functions | ||
|
||
-spec start(HostType :: mongooseim:host_type()) -> ok. | ||
start(HostType) -> | ||
mongoose_backend:init_per_host_type(HostType, ?MAIN_MODULE, [], rdbms), | ||
Args = [HostType], | ||
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args). | ||
|
||
-spec revoke(mongooseim:host_type(), jid:jid()) -> ok | not_found. | ||
revoke(HostType, JID) -> | ||
Args = [HostType, JID], | ||
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args). | ||
|
||
-spec get_valid_sequence_number(mongooseim:host_type(), jid:jid()) -> integer(). | ||
get_valid_sequence_number(HostType, JID) -> | ||
Args = [HostType, JID], | ||
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args). | ||
|
||
-spec clean_tokens(mongooseim:host_type(), jid:jid()) -> ok. | ||
clean_tokens(HostType, JID) -> | ||
Args = [HostType, JID], | ||
mongoose_backend:call(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters