25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Update cyrsasl_oauth to internal API changes

This commit is contained in:
Alexey Shchepin 2017-03-14 17:25:09 +03:00
parent 069d28b1ed
commit 9a142eb807

View File

@ -53,7 +53,7 @@ mech_step(State, ClientIn) ->
case prepare(ClientIn) of case prepare(ClientIn) of
[AuthzId, User, Token] -> [AuthzId, User, Token] ->
case ejabberd_oauth:check_token( case ejabberd_oauth:check_token(
User, State#state.host, <<"sasl_auth">>, Token) of User, State#state.host, [<<"sasl_auth">>], Token) of
true -> true ->
{ok, {ok,
[{username, User}, {authzid, AuthzId}, [{username, User}, {authzid, AuthzId},
@ -69,12 +69,18 @@ prepare(ClientIn) ->
[<<"">>, UserMaybeDomain, Token] -> [<<"">>, UserMaybeDomain, Token] ->
case parse_domain(UserMaybeDomain) of case parse_domain(UserMaybeDomain) of
%% <NUL>login@domain<NUL>pwd %% <NUL>login@domain<NUL>pwd
[User, _Domain] -> [UserMaybeDomain, User, Token]; [User, _Domain] -> [User, User, Token];
%% <NUL>login<NUL>pwd %% <NUL>login<NUL>pwd
[User] -> [<<"">>, User, Token] [User] -> [User, User, Token]
end; end;
%% login@domain<NUL>login<NUL>pwd %% login@domain<NUL>login<NUL>pwd
[AuthzId, User, Token] -> [AuthzId, User, Token]; [AuthzId, User, Token] ->
case parse_domain(AuthzId) of
%% login@domain<NUL>login<NUL>pwd
[AuthzUser, _Domain] -> [AuthzUser, User, Token];
%% login<NUL>login<NUL>pwd
[AuthzUser] -> [AuthzUser, User, Token]
end;
_ -> error _ -> error
end. end.