mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Add oauth_access option
This commit is contained in:
parent
1781a58929
commit
88a206400a
@ -125,10 +125,25 @@ get_client_identity(Client, Ctx) -> {ok, {Ctx, {client, Client}}}.
|
|||||||
verify_redirection_uri(_, _, Ctx) -> {ok, Ctx}.
|
verify_redirection_uri(_, _, Ctx) -> {ok, Ctx}.
|
||||||
|
|
||||||
authenticate_user({User, Server}, {password, Password} = Ctx) ->
|
authenticate_user({User, Server}, {password, Password} = Ctx) ->
|
||||||
case ejabberd_auth:check_password(User, Server, Password) of
|
case jlib:make_jid(User, Server, <<"">>) of
|
||||||
true ->
|
#jid{} = JID ->
|
||||||
{ok, {Ctx, {user, User, Server}}};
|
Access =
|
||||||
false ->
|
ejabberd_config:get_option(
|
||||||
|
{oauth_access, JID#jid.lserver},
|
||||||
|
fun(A) when is_atom(A) -> A end,
|
||||||
|
none),
|
||||||
|
case acl:match_rule(JID#jid.lserver, Access, JID) of
|
||||||
|
allow ->
|
||||||
|
case ejabberd_auth:check_password(User, Server, Password) of
|
||||||
|
true ->
|
||||||
|
{ok, {Ctx, {user, User, Server}}};
|
||||||
|
false ->
|
||||||
|
{error, badpass}
|
||||||
|
end;
|
||||||
|
deny ->
|
||||||
|
{error, badpass}
|
||||||
|
end;
|
||||||
|
error ->
|
||||||
{error, badpass}
|
{error, badpass}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -470,4 +485,6 @@ logo() ->
|
|||||||
|
|
||||||
opt_type(oauth_expire) ->
|
opt_type(oauth_expire) ->
|
||||||
fun(I) when is_integer(I), I >= 0 -> I end;
|
fun(I) when is_integer(I), I >= 0 -> I end;
|
||||||
opt_type(_) -> [oauth_expire].
|
opt_type(oauth_access) ->
|
||||||
|
fun(A) when is_atom(A) -> A end;
|
||||||
|
opt_type(_) -> [oauth_expire, oauth_access].
|
||||||
|
Loading…
Reference in New Issue
Block a user