Issue Details (XML | Word | Printable)

Key: MDL-17135
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jerome Mouneyrac
Reporter: Ludo ( Marc Alier)
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-12886

Define an authentication method (for the webservice service)

Created: 05/Nov/08 07:52 PM   Updated: 11/Nov/09 10:42 AM
Return to search
Component/s: General
Affects Version/s: 2.0
Fix Version/s: None

Participants: Jerome Mouneyrac, Ludo ( Marc Alier), Martin Dougiamas, Patrick Pollet and Petr Skoda
Security Level: None
Resolved date: 11/Nov/09
Affected Branches: MOODLE_20_STABLE


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Patrick Pollet added a comment - 15/Dec/08 05:04 PM
Hello,

Any advance in this task ?

Are you planning to add authentication data at every call, thus modifying the parameters required by the WS calls, or having them in some session data, thus modifying every function implementation to check for these data ?

In any case, you would have to sent to WS login/password data in some sort of login/logout call .

How do you plan to support "ticket based authentication" such as CAS or Shiboleth ?

Since WS calls are going to be used by external developpers to sync their information systems with Moodle, you will have to provide them with an admin login/password access to be able to create/modify Moodle entities ; this could be a major security issue since they could use this access in standard Moodle interactive mode. One possible solution could be to have a "web service only" authentication plugin, maybe with IP addresses restriction ?

Cheers.


Ludo ( Marc Alier) added a comment - 15/Dec/08 08:30 PM - edited
In my planification I expect to have a proposal and working code running by mid Jan 2009. Then we need to discuss this code with skodak and the rest.
We will consider what you suggest, but thiese issues should be addressed in another level.
Cheers

Patrick Pollet added a comment - 16/Dec/08 12:01 AM
You must pay a particular attention to setting correctly the global variable $USER at every WS call.
I am having some reports of failure of my SOAP implementation against Moodle 1.9 due to the fact that many calls in datalib and accesslib now relies on $USER and superbly ignore an $userid parameter such as :
  • get_my_courses
  • has_capability
    ...

This was not a problem in "interactive mode" but is critical with WS when currently logged in user is quite often different of the user to which the WS call applies...

Cheers.


Martin Dougiamas added a comment - 03/Feb/09 04:20 PM
Assigning this to Jerome, though he will need some help with the new sessions that Petr's been working on.

A basic spec is currently here: http://docs.moodle.org/en/Development:Web_services#Authentication

This is a little different from the auth/webservices plugin we talked about yesterday, Petr, but after a bit of pushback from Eloy I think it's probably enough. Did we forget anything?


Martin Dougiamas made changes - 03/Feb/09 04:20 PM
Field Original Value New Value
Assignee David Castro [ dcastro ] Jerome Mouneyrac [ jerome ]
Jerome Mouneyrac made changes - 03/Feb/09 04:40 PM
Status Open [ 1 ] In Progress [ 3 ]
Jerome Mouneyrac committed 9 files to 'Moodle CVS' - 13/Feb/09 12:08 PM
Web service MDL-17135 add web services administration
MODIFY admin/settings/security.php   Rev. 1.33    (+16 -1 lines)
ADD webservice/rest/Attic/lib.php   Rev. 1.10    (+0 -0 lines)
ADD admin/Attic/wsprotocols.php   Rev. 1.1    (+0 -0 lines)
MODIFY webservice/amf/Attic/lib.php   Rev. 1.2    (+5 -1 lines)
MODIFY webservice/lib.php   Rev. 1.2    (+71 -9 lines)
MODIFY lib/adminlib.php   Rev. 1.325    (+99 -2 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.270    (+7 -0 lines)
MODIFY webservice/xmlrpc/Attic/lib.php   Rev. 1.2    (+6 -2 lines)
MODIFY webservice/soap/Attic/lib.php   Rev. 1.2    (+12 -4 lines)
Mitsuhiro Yoshida committed 1 file to 'Lang CVS' - 14/Feb/09 03:05 AM
MDL-17135 Translated new strings for web services administration.
MODIFY ja_utf8/admin.php   Rev. 1.343    (+7 -0 lines)
martignoni committed 1 file to 'Lang CVS' - 16/Feb/09 04:33 AM
MDL-17135 New strings translated
MODIFY fr_utf8/admin.php   Rev. 1.350    (+8 -1 lines)
Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 16/Feb/09 05:06 PM
web service MDL-17135 add moodle/site:usewebservice capability - display only web service users into administration page
MODIFY lib/db/access.php   Rev. 1.100    (+8 -1 lines)
MODIFY lib/adminlib.php   Rev. 1.326    (+3 -3 lines)
MODIFY lang/en_utf8/role.php   Rev. 1.86    (+2 -1 lines)
Mitsuhiro Yoshida committed 4 files to 'Lang CVS' - 17/Feb/09 12:34 AM
MDL-17284 MDL-17296 Translated new strings for quiz.
MDL-17135 Translated a new string for role.
MDL-18258 Translated a new string for risky default course role hint.
MODIFY ja_utf8/quiz.php   Rev. 1.172    (+4 -1 lines)
MODIFY ja_utf8/role.php   Rev. 1.86    (+2 -1 lines)
MODIFY ja_utf8/README   Rev. 1.946    (+1 -1 lines)
MODIFY ja_utf8/report_security.php   Rev. 1.15    (+3 -2 lines)
martignoni committed 1 file to 'Lang CVS' - 01/Mar/09 07:49 PM
MDL-17135 New string
MODIFY fr_utf8/role.php   Rev. 1.107    (+2 -1 lines)
Jerome Mouneyrac made changes - 25/May/09 03:45 PM
Affects Version/s 2.0 [ 10122 ]
Affects Version/s 1.9.3 [ 10290 ]
Petr Skoda added a comment - 07/Oct/09 04:25 AM
committing basic auth plugin, you can use ->user_login_webservice($username, $password) to authenticate from web service directly for now
later we need to add ip restrictions and maybe some wrapper function

Petr Skoda committed 2 files to 'Moodle CVS' - 07/Oct/09 04:26 AM
MDL-17135 basic ws auth plugin, this plugin does not allow normal logins through /login/index.php
ADD lang/en_utf8/auth_webservice.php   Rev. 1.1    (+0 -0 lines)
ADD auth/webservice/auth.php   Rev. 1.1    (+0 -0 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 07/Oct/09 04:47 AM
MDL-17135 adding more security restrictions for web service users
MODIFY version.php   Rev. 1.1276    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.338    (+14 -11 lines)
MODIFY lib/db/install.xml   Rev. 1.217    (+6 -3 lines)
Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 14/Oct/09 05:47 PM
webservice MDL-17135 add user selector for service to the administration
MODIFY admin/Attic/external_service_users.php   Rev. 1.2    (+74 -1 lines)
ADD admin/webservice/lib.php   Rev. 1.1    (+0 -0 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.8    (+5 -0 lines)
Jerome Mouneyrac committed 1 file to 'Moodle CVS' - 14/Oct/09 05:50 PM
webservice MDL-17135 remove varlog() calls (personal debug function)
MODIFY admin/Attic/external_service_users.php   Rev. 1.3    (+0 -2 lines)
Jerome Mouneyrac committed 2 files to 'Moodle CVS' - 15/Oct/09 10:34 AM
webservice MDL-17135 code cleaning
MODIFY admin/webservice/lib.php   Rev. 1.2    (+38 -73 lines)
MODIFY admin/Attic/external_service_users.php   Rev. 1.4    (+2 -2 lines)
Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 16/Oct/09 04:50 PM
webservice MDL-17135 add service user settings administration
MODIFY admin/Attic/external_service_users.php   Rev. 1.5    (+89 -4 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.9    (+8 -4 lines)
MODIFY admin/webservice/lib.php   Rev. 1.3    (+15 -4 lines)
Jerome Mouneyrac committed 4 files to 'Moodle CVS' - 19/Oct/09 08:01 PM
webservice MDL-17135 add service administration page
MODIFY admin/Attic/external_forms.php   Rev. 1.2    (+0 -33 lines)
ADD admin/webservice/script.js   Rev. 1.1    (+0 -0 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.10    (+9 -1 lines)
MODIFY admin/Attic/external_service.php   Rev. 1.2    (+128 -15 lines)
Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 19/Oct/09 11:09 PM
webservice MDL-17135 improve service function selection into administration page
ADD lang/en_utf8/Attic/servicedescription.php   Rev. 1.1    (+0 -0 lines)
MODIFY admin/Attic/external_service_functions.php   Rev. 1.2    (+73 -17 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.11    (+2 -0 lines)
Jerome Mouneyrac committed 4 files to 'Moodle CVS' - 19/Oct/09 11:12 PM
webservice MDL-17135 remove old Moodleforms for service admin page
MODIFY admin/Attic/external_service_users.php   Rev. 1.6    (+0 -1 lines)
DEL admin/Attic/external_forms.php   Rev. 1.3    (+0 -0 lines)
MODIFY admin/Attic/external_service_functions.php   Rev. 1.3    (+0 -1 lines)
MODIFY admin/Attic/external_service.php   Rev. 1.3    (+0 -1 lines)
Petr Skoda added a comment - 20/Oct/09 04:07 AM
hi Jerome,
1/ please do not use "moodle" in lang strings
2/ we are not usually putting underscores into string names

the rest looks fine


Petr Skoda added a comment - 20/Oct/09 04:57 AM
also the valid until can not be disabled in the new UI, right?

Jerome Mouneyrac added a comment - 20/Oct/09 10:02 AM
Thanks Petr

I think because the function description are a bit special: the string key should be equal to the function name.
It would be good that the guy translating do not do any error. Maybe seeing not common keys will make him think that these strings are special.
Otherwise if you really want I can remove underscores. Removing "moodle" from the key is wrong because it just makes a special case. I mean the string key are the function name. If the function name start with 'moodle' so the key should start with 'moodle'. Making a special case : 1. add more code 2. create confusion for a new ws developer: why did the function name lost the 'moodle' part?

Good catch for the Valid Until field. I though about that then forgot to implement.


Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 20/Oct/09 02:34 PM
webservice MDL-17135 fix navigation (kudo to Sam) + trivial few changes
MODIFY admin/Attic/external_service_users.php   Rev. 1.7    (+16 -4 lines)
MODIFY admin/settings/plugins.php   Rev. 1.50    (+4 -4 lines)
MODIFY lib/adminlib.php   Rev. 1.403    (+2 -2 lines)
Petr Skoda added a comment - 20/Oct/09 03:21 PM
right! sorry, I forgot about the function names here

Petr Skoda added a comment - 20/Oct/09 03:22 PM
oh,but then the name of the function or anything else defined in services.php must be stored in the language pack of the component, not some new file

Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 20/Oct/09 10:33 PM
webservice MDL-17135 add disable javascript to the valid until fields
MODIFY admin/webservice/script.js   Rev. 1.2    (+15 -0 lines)
MODIFY webservice/wsdoc.php   Rev. 1.6    (+29 -146 lines)
MODIFY admin/Attic/external_service_users.php   Rev. 1.8    (+23 -7 lines)
Petr Skoda added a comment - 22/Oct/09 02:19 AM
oh, I just noticed you replaced the form for web service setting with custom html - this is a strict no, no, reverting; instead you have to create new formslib element for capability selection if needed, this change caused major regressions - the build-in services must not be modified!

Petr Skoda added a comment - 22/Oct/09 02:21 AM
also please use standard help icons in forms instead of long explanation texts - removing from lang pack too for now

Petr Skoda committed 5 files to 'Moodle CVS' - 22/Oct/09 03:36 AM
MDL-17135 reverting recent change in service management UI - since 1.7 the right way is to use formslib instead of hand written forms (which is roughly equiwalent to new outputlib stuff, sorry); this also fixes regression which incorrectly allowed editting of built-in services
ADD admin/Attic/external_forms.php   Rev. 1.4    (+0 -0 lines)
MODIFY admin/webservice/script.js   Rev. 1.3    (+0 -73 lines)
MODIFY lib/adminlib.php   Rev. 1.404    (+7 -6 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.14    (+7 -15 lines)
MODIFY admin/Attic/external_service.php   Rev. 1.4    (+16 -128 lines)
Petr Skoda added a comment - 22/Oct/09 03:57 AM
I am going to reshuffle the files in admin directory a bit, I did not expect there will be so many of them needed,going to fix some incorrect hardcoded admin paths at the same time

Petr Skoda committed 14 files to 'Moodle CVS' - 22/Oct/09 03:58 AM
MDL-17135 moving all webservice and external API related admin UI to new directory, I did not expect there would be so many files, sorry for the trouble
ADD admin/webservice/service_users.php   Rev. 1.1    (+0 -0 lines)
DEL admin/Attic/external_service.php   Rev. 1.5    (+0 -0 lines)
DEL admin/Attic/external_service_functions.php   Rev. 1.4    (+0 -0 lines)
MODIFY admin/webservice/script.js   Rev. 1.4    (+1 -1 lines)
ADD admin/webservice/forms.php   Rev. 1.1    (+0 -0 lines)
ADD admin/webservice/service_functions.php   Rev. 1.1    (+0 -0 lines)
MODIFY admin/webservice/lib.php   Rev. 1.4    (+1 -1 lines)
ADD admin/webservice/protocols.php   Rev. 1.1    (+0 -0 lines)
MODIFY admin/settings/plugins.php   Rev. 1.51    (+4 -4 lines)
DEL admin/Attic/external_service_users.php   Rev. 1.9    (+0 -0 lines)
MODIFY lib/adminlib.php   Rev. 1.405    (+4 -4 lines)
ADD admin/webservice/service.php   Rev. 1.1    (+0 -0 lines)
DEL admin/Attic/webservice_protocols.php   Rev. 1.2    (+0 -0 lines)
DEL admin/Attic/external_forms.php   Rev. 1.5    (+0 -0 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 22/Oct/09 04:01 AM
MDL-17135 fixed too general js function name + fixed whitespace coding style
MODIFY admin/webservice/service_users.php   Rev. 1.2    (+1 -1 lines)
MODIFY admin/webservice/script.js   Rev. 1.5    (+3 -5 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 22/Oct/09 04:03 AM
MDL-17135 fixed whitespace coding style
MODIFY admin/webservice/service_functions.php   Rev. 1.2    (+1 -2 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 22/Oct/09 05:24 AM
MDL-17135 fixing XSRF regression; adding description and removing incomplete support for localised function names; removing string that will not be used in final version of UI (this would only confuse&slow down translators)
DEL lang/en_utf8/Attic/servicedescription.php   Rev. 1.2    (+0 -0 lines)
MODIFY admin/webservice/service_functions.php   Rev. 1.3    (+21 -31 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.15    (+0 -1 lines)
Petr Skoda committed 4 files to 'Moodle CVS' - 27/Oct/09 03:10 AM
MDL-17135 external token access support
MODIFY lib/externallib.php   Rev. 1.15    (+17 -0 lines)
MODIFY lib/db/upgrade.php   Rev. 1.339    (+32 -1 lines)
MODIFY lib/db/install.xml   Rev. 1.218    (+23 -2 lines)
MODIFY version.php   Rev. 1.1300    (+1 -1 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 27/Oct/09 05:44 AM
MDL-17135 external token access support
MODIFY webservice/rest/locallib.php   Rev. 1.18    (+7 -2 lines)
MODIFY webservice/wsdoc.php   Rev. 1.7    (+2 -1 lines)
MODIFY webservice/lib.php   Rev. 1.34    (+162 -196 lines)
Martin Dougiamas added a comment - 02/Nov/09 02:17 PM
Petr, I'm looking at the reverting 3 comments back. Fixing the regression that allowed editing of built-in services is fair enough, but was it really necessary to just suddenly remove all the code to create the capability selection? Since we don't just create new formslib elements every single time we have some special need, shouldn't we have a talk about if that element is useful beyond this one case and and how it should work?

Petr Skoda added a comment - 02/Nov/09 03:52 PM
aah, yes it was very necessary - the problem is we can not use tim's new output lib classes for making of real forms - it was clearly not designed for that.

and yes, the new capability selection element is the right direction.


Jerome Mouneyrac committed 8 files to 'Moodle CVS' - 05/Nov/09 03:06 PM
webservice MDL-17135 create searchable select form element + use it in service form for selecting a capability
MODIFY lang/en_utf8/webservice.php   Rev. 1.17    (+2 -0 lines)
ADD lib/form/searchableselector.js   Rev. 1.1    (+0 -0 lines)
MODIFY admin/webservice/forms.php   Rev. 1.2    (+17 -1 lines)
MODIFY lang/en_utf8/error.php   Rev. 1.209    (+2 -1 lines)
ADD lib/form/searchableselector.php   Rev. 1.1    (+0 -0 lines)
MODIFY lang/en_utf8/form.php   Rev. 1.22    (+2 -1 lines)
MODIFY lib/formslib.php   Rev. 1.193    (+1 -0 lines)
MODIFY admin/webservice/service.php   Rev. 1.2    (+5 -1 lines)
Jerome Mouneyrac committed 1 file to 'Moodle CVS' - 05/Nov/09 03:50 PM
webservice MDL-17135 add notification when the current required capability doesn't exist anymore + remove TODO comment about checking that the service names are unique because we should end up to find a way to i18n service names => The uniqueness should be checked during service discovery
MODIFY admin/webservice/forms.php   Rev. 1.3    (+23 -15 lines)
Jerome Mouneyrac committed 4 files to 'Moodle CVS' - 06/Nov/09 03:50 PM
webservice MDL-17135 add timecreated + timemodified fields to the service table and save them in the service form
MODIFY lib/db/install.xml   Rev. 1.221    (+19 -17 lines)
MODIFY version.php   Rev. 1.1317    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.344    (+24 -0 lines)
MODIFY admin/webservice/service.php   Rev. 1.3    (+4 -1 lines)
Jerome Mouneyrac committed 2 files to 'Moodle CVS' - 06/Nov/09 04:17 PM
webservice MDL-17135 add logging to add/edit/delete service action
MODIFY admin/webservice/service.php   Rev. 1.4    (+4 -3 lines)
MODIFY lang/en_utf8/webservice.php   Rev. 1.18    (+4 -0 lines)
Petr Skoda added a comment - 09/Nov/09 06:12 AM
fixing fatal installation error caused by the new mandatory timecreated field

Petr Skoda committed 1 file to 'Moodle CVS' - 09/Nov/09 06:12 AM
MDL-17135 fixed fatal installation and ugprade error
MODIFY lib/upgradelib.php   Rev. 1.38    (+1 -0 lines)
Jerome Mouneyrac committed 3 files to 'Moodle CVS' - 09/Nov/09 11:38 AM
webservice MDL-17135 revert the service function form to a Moodle form + user searchable selector + add default size to the searchable selector
MODIFY lib/form/searchableselector.php   Rev. 1.2    (+4 -0 lines)
MODIFY admin/webservice/service_functions.php   Rev. 1.4    (+8 -46 lines)
MODIFY admin/webservice/forms.php   Rev. 1.4    (+33 -2 lines)
Jerome Mouneyrac committed 1 file to 'Moodle CVS' - 09/Nov/09 02:30 PM
webservice MDL-17135 display function descriptions into the function form
MODIFY admin/webservice/forms.php   Rev. 1.5    (+6 -0 lines)
Jerome Mouneyrac added a comment - 11/Nov/09 10:42 AM
I think we can close this issue as authentication has been defined, implemented and the specification are written.

Jerome Mouneyrac made changes - 11/Nov/09 10:42 AM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Jerome Mouneyrac committed 7 files to 'Moodle CVS' - 11/Nov/09 11:15 PM
webservice MDL-17135 Add some Zend library needed for Amf + add one line in order to set amf server in development mode
ADD lib/zend/Zend/Loader/PluginLoader/Exception.php   Rev. 1.3    (+0 -0 lines)
ADD lib/zend/Zend/Loader/Exception.php   Rev. 1.3    (+0 -0 lines)
ADD lib/zend/Zend/Loader/PluginLoader/Interface.php   Rev. 1.3    (+0 -0 lines)
ADD lib/zend/Zend/Loader/PluginLoader.php   Rev. 1.3    (+0 -0 lines)
MODIFY lib/zend/Zend/Version.php   Rev. 1.4    (+2 -2 lines)
ADD lib/zend/Zend/Auth.php   Rev. 1.3    (+0 -0 lines)
MODIFY webservice/amf/locallib.php   Rev. 1.2    (+2 -0 lines)