Commit Graph

77 Commits

Author SHA1 Message Date
Mickael Remond 39640b67c7
Add support for rich error reporting for API 2016-07-30 13:08:30 +02:00
Mickael Remond fb2603d3cd
Return 409 conflict error code on register if user already exists 2016-07-30 11:50:04 +02:00
Evgeniy Khramtsov f91f2bc3d2 Rewrite several modules to use XML generator 2016-07-29 13:21:00 +03:00
Mickael Remond d7ad99f147
Initial attempt on access on commands
May change and will require more work / test / refactor
2016-07-25 11:43:49 +02:00
Mickael Remond 68555ff466
Add support for checking access rules conformance for commands 2016-07-23 18:21:45 +02:00
Mickael Remond 2c70c572c8
Clean-up of error codes and format json structure 2016-07-23 18:21:45 +02:00
Paweł Chmielowski bdfef09c0f Fix handling of complex values as arguments in http_api 2016-07-22 15:26:27 +02:00
Pablo Polvorin 33e0283f0d Add 'ejabberd:user' and 'ejabberd:admin' oauth scopes
'ejabberd:user' includes all commands defined with policy "user".
'ejabberd:admin' includes commands defined with policy "admin".
2016-07-19 00:24:06 -03:00
Pablo Polvorin 673a654c47 Fix ce0d1704c6
Original request was to allow ejabberd sysadmin to generate
tokens for specific users.  JIDs must not be passed as argument
when requesting the tokens.
2016-07-18 20:25:23 -03:00
Evgeniy Khramtsov 4220a2b98c Make modules loading in a dependent order (#1191) 2016-07-06 14:58:48 +03:00
Pablo Polvorin ce0d1704c6 Allow generation of oauth tokens from command line
Oauth tokens can be generated for commands (scopes) having admin|user|open
policy. Restricted commands are not available as those are only usable
from ejabberdctl command line.

Four new commands are available:

$ejabberdctl oauth_issue_token "stats;get_roster"
    Generates a token authorized to call both stats and get_roster
    commands.  Note scopes must be separated by semicolon.

$ejabberdctl oauth_list_tokens
    List tokens generated from the command line, with their scope
    and expirity time.

$ejabberdctl oauth_list_scopes
    List scopes available

$ejabberdctl oauth_revoke_token "Lbs7qdJfdKXOWzVrArgyckY055tE1xnt"
    Revokes the given token
2016-06-29 00:22:28 -03:00
Paweł Chmielowski 52d45604ba Use new access_rules_validator in couple places 2016-06-21 12:28:53 +02:00
Paweł Chmielowski 1981e13326 Allow passing username and ip to ejabberd_comamnds, and use it in mod_http_api 2016-05-26 11:08:53 +02:00
Mickael Remond 47266de6d7 Do not use underscore variable 2016-04-01 12:24:49 +02:00
Mickael Remond b5f1479763 Fix tests, they are now running fine locally 2016-04-01 11:13:48 +02:00
Mickael Remond ef2e2e45b3 Fix failing tests 2016-03-31 17:34:58 +02:00
Mickael Remond 7988e2e350 Merge lastest commits from master 2016-03-31 15:37:21 +02:00
Alexey Shchepin 3dc55c6d47 Commands refactor, first pass.
- add API versionning
- changed error handling, based on exception
- commands moved/merged from mod_admin_p1 to mod_admin_extra
- command bufixes
- add some elixir unit test cases

Squashed commit of the following:

commit dd59855b3486f78a9349756e4f102e79b3accff8
Merge: 14e8ffc 506e08e
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 30 11:43:18 2015 +0100

    Merge branch '3.2.x' into api

commit 14e8ffce78cbea6c8605371d1fc50a0c1d1e012c
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 27 16:35:17 2015 +0100

    Added OAuth tests to ejabberd_commands

commit f81c550c14628edfe4861c228576cb767924366a
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 27 16:34:55 2015 +0100

    Added some mod_http_api tests

commit 6a64578d5b2ba532a2feb6503ed98561e56d5d53
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Oct 26 15:29:36 2015 +0100

    Fix get_last command test

    Previous version won't work with dst.

commit 27e0cde9e9c1f001effe68f8424a365ad947c068
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 17:59:34 2015 +0200

    Add tests on admin command policy

commit 19dad8d54f54c9fabd454280483cccfb06c8e78a
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 16:49:36 2015 +0200

    Added command related tests (http api & user policy)

commit e0e596ab4a3f3a70aba5f374f028939ab794de33
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 16:49:16 2015 +0200

    Fix command call.

commit 128cd7d1ede3c47a34f8ec3a750c980ccad2c61d
Merge: 60c4c4c 447313c
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 22 14:48:39 2015 +0200

    Merge branch '3.2.x' into api

commit 60c4c4c0751302524c14219c6bc8c56a6069a689
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 22 14:45:57 2015 +0200

    Fix ejabberd_commands spec.

commit 8e145c28c5da762c2b93ee32327eff1db94ebfed
Merge: 397273a f13dc94
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 18:26:07 2015 +0200

    Merge branch '3.2.x' into api

commit 397273a23ed415feac87aed33da6452229793387
Merge: c30e89b f289e27
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 15:27:45 2015 +0200

    Merge branch '3.2.x' into api

commit c30e89bb8a0013bff37e61e4c6953350c9c1f313
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 12:47:02 2015 +0200

    Merge mod_http_api

commit 7b0db22b4acd48ff6fabce41c1b2525e6580a3c5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 16 11:55:48 2015 +0200

    Fix exunit tests to run with common_test suites

commit d8b1a89800ac7379a57a7eb4a09c3c93c3e1e5eb
Merge: 2879ae8 63455b3
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 15 11:39:45 2015 +0200

    Merge branch '3.2.x' into api

commit 2879ae87ff3eee369ef3d780136b96ecff5285d1
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 14 14:53:44 2015 +0200

    Fix update_roster command.

commit a1d453dd7a3afda9861a8d747494a45057ad574b
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 13 16:14:28 2015 +0200

    API commands refactor

    Moving and/or merging commands from mod_admin_p1 to mod_admin_extra

commit b709ed26b0fc0ca4f3bdd5a59fa58ec7e3db97fa
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 7 15:10:01 2015 +0200

    Add tests on commands

commit 6711687bee9c672cb3d5aed0744e13420ecf6dbd
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 29 15:58:16 2015 +0200

    Add ejabberd_commands tests

commit df8682f419cf3877e77e36a19bca0fc55dc991f8
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Sep 28 14:54:39 2015 +0200

    Added API versioning for ejabberdctl and rest commands

commit cd017b0e3aac431bc3ee807ceb7f8641e1523ef5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Sep 18 11:21:45 2015 +0200

    Better error handling of HTTP API commands.

commit ca5cb6acd8e4643f9d6c484d2277b0d7e88471e5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 15 15:03:05 2015 +0200

    add commands to mod_admin_extra:
    - get_offline_count
    - get_presence
    - change_password

commit 7f583fa099e30ac2b0915669fd8f102ac565b833
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 15 15:02:16 2015 +0200

    Improve REST API error handling

commit 14753b1c02cdce434a786b7f80f6c09f0d210075
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Sep 14 10:51:17 2015 +0200

    Change REST API return codes for integer type.
2016-03-31 14:53:31 +03:00
Mickael Remond 809057678b Better error report when command is not exposed through API 2016-03-30 15:59:29 +02:00
Mickael Remond 36ac1cd6c7 Returns unauthorized error when we do not have correct credentials 2016-03-30 14:49:19 +02:00
Mickael Remond ead83b008c HTTP ReST API now supports 'open' ejabberd commands 2016-03-30 14:23:09 +02:00
Mickael Remond 82cf7f7ca8 Adds support for option admin_ip_access on mod_http_api
This allows granting access to admin commands to backend, by using IP address restrictions.
(Pawel Chmielowski)
2016-03-29 19:40:20 +02:00
Mickael Remond 53d12caa56 Fix log printout
Log is not only called for admin commands. It is call for all commands call.
2016-03-29 11:21:53 +02:00
Evgeniy Khramtsov 46568fb959 Merge commit 'refs/pull/524/head' of github.com:processone/ejabberd into sasl-api-change 2016-03-25 18:16:50 +03:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Christophe Romain a1129dc96b Add OAuth support (thanks to Aleksey) 2015-09-25 15:49:07 +02:00