Checking users is active in SM for JWT authenticated user (#3795)

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
This commit is contained in:
Simon Paitrault 2022-03-24 17:03:50 +01:00 committed by GitHub
parent 5506b838c8
commit 68762146d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -85,7 +85,14 @@ check_password(User, AuthzId, Server, Token) ->
end
end.
user_exists(_User, _Host) -> {nocache, false}.
user_exists(User, Host) ->
%% Checking that the user has an active session
%% If the session was negociated by the JWT auth method then we define that the user exists
%% Any other cases will return that the user doesn't exist
{nocache, case ejabberd_sm:get_user_info(User, Host) of
[{_, Info}] -> proplists:get_value(auth_module, Info) == ejabberd_auth_jwt;
_ -> false
end}.
use_cache(_) ->
false.