Skip to content

Commit d2fb995

Browse files
committed
ejabberd_oauth: Log error if oauth_list_tokens executed with unsupported DB (#4506)
1 parent 6c751b0 commit d2fb995

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ejabberd_oauth.erl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,17 @@ oauth_issue_token(Jid, TTLSeconds, Scopes) ->
172172
end.
173173

174174
oauth_list_tokens() ->
175+
oauth_list_tokens(get_db_backend()).
176+
177+
oauth_list_tokens(ejabberd_auth_mnesia) ->
175178
Tokens = mnesia:dirty_match_object(#oauth_token{_ = '_'}),
176179
{MegaSecs, Secs, _MiniSecs} = os:timestamp(),
177180
TS = 1000000 * MegaSecs + Secs,
178181
[{Token, jid:encode(jid:make(U,S)), Scope, integer_to_list(Expires - TS) ++ " seconds"} ||
179-
#oauth_token{token=Token, scope=Scope, us= {U,S},expire=Expires} <- Tokens].
180-
182+
#oauth_token{token=Token, scope=Scope, us= {U,S},expire=Expires} <- Tokens];
183+
oauth_list_tokens(DBMod) ->
184+
?ERROR_MSG("Command oauth_list_tokens not implemented for database backend ~p", [DBMod]),
185+
[].
181186

182187
oauth_revoke_token(Token) ->
183188
DBMod = get_db_backend(),

0 commit comments

Comments
 (0)