From 9a142eb8075d98b4741222bbb76f897b22795acf Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Tue, 14 Mar 2017 17:25:09 +0300 Subject: [PATCH] Update cyrsasl_oauth to internal API changes --- src/cyrsasl_oauth.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cyrsasl_oauth.erl b/src/cyrsasl_oauth.erl index 1290b2822..27b5d92ee 100644 --- a/src/cyrsasl_oauth.erl +++ b/src/cyrsasl_oauth.erl @@ -53,7 +53,7 @@ mech_step(State, ClientIn) -> case prepare(ClientIn) of [AuthzId, User, Token] -> case ejabberd_oauth:check_token( - User, State#state.host, <<"sasl_auth">>, Token) of + User, State#state.host, [<<"sasl_auth">>], Token) of true -> {ok, [{username, User}, {authzid, AuthzId}, @@ -69,12 +69,18 @@ prepare(ClientIn) -> [<<"">>, UserMaybeDomain, Token] -> case parse_domain(UserMaybeDomain) of %% login@domainpwd - [User, _Domain] -> [UserMaybeDomain, User, Token]; + [User, _Domain] -> [User, User, Token]; %% loginpwd - [User] -> [<<"">>, User, Token] + [User] -> [User, User, Token] end; %% login@domainloginpwd - [AuthzId, User, Token] -> [AuthzId, User, Token]; + [AuthzId, User, Token] -> + case parse_domain(AuthzId) of + %% login@domainloginpwd + [AuthzUser, _Domain] -> [AuthzUser, User, Token]; + %% loginloginpwd + [AuthzUser] -> [AuthzUser, User, Token] + end; _ -> error end.