Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53777

Include support for login via the browser in the new Moodle Mobile admin tool

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Check that the admin tool Mobile cannot be uninstalled from the system (via Admin/Plugins/Manage plugins)
      2. Now, go to Admin/Plugins/Web Service/Mobile, change the type of login settings and check that:
      3. After executing the following curl request you see the correct value for typeoflogin (1 for via the app, 2 via browser, 3 via embedded browser)
        • You only see launchurl when typeoflogin is 2 or 3
        • launchurl is a correct utl pointing to your site admin/tool/launch.php

          curl 'http://localhost/m/stable_master/lib/ajax/service.php' --data-binary '[{"index":0,"methodname":"tool_mobile_get_public_config","args":{}}]' | python -m "json.tool"

      4. Now, we are going to check that the normal login for the app still works
        • Open the Mobile app, and log in with an existent user (it should work)
        • Create a new user, and try to log in to that user (it should work)
      5. Now, test that admin/tool/mobile/launch.php works
        • As admin, enable Mobile services and set typeoflogin in Admin/Plugins/Web Service/Mobile to log in via browser and logout
        • Ensure that you are not logged in the site
        • Point your browser to admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc, you should be redirected to /login/index.php, after login in you should be redirected back to admin/tool/mobile/launch.php
        • You must check the previous point using the Network options in your browser developer tool (check that login/index.php is redirecting back to admin/tool/launch.php), admin/tool/mobile/launch.php will try to open a custom url scheme so you will see an empty screen and probably login/index.php still in the url. A good way to test this is in Chrome, enable the developer tools, and then switch to the "Mobile device emulation" tool, is an icon that displays a phone/tablet, then you canselect Iphone or iPad, this will change the user-agent. If you try again the process simulating being a iOs device you will see a screen with a link saying "Please, click here if the app does not open automatically", if you inspect the link you will see that points to moodlemobile://token=A_HEX_TOKEN
        • If you try to launch admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc while the mobile services are disabled you will get an error
        • If you try to launch it while type of login is set to via app, you will get an error
      Show
      Check that the admin tool Mobile cannot be uninstalled from the system (via Admin/Plugins/Manage plugins) Now, go to Admin/Plugins/Web Service/Mobile, change the type of login settings and check that: After executing the following curl request you see the correct value for typeoflogin (1 for via the app, 2 via browser, 3 via embedded browser) You only see launchurl when typeoflogin is 2 or 3 launchurl is a correct utl pointing to your site admin/tool/launch.php curl 'http://localhost/m/stable_master/lib/ajax/service.php' --data-binary ' [{"index":0,"methodname":"tool_mobile_get_public_config","args":{}}] ' | python -m "json.tool" Now, we are going to check that the normal login for the app still works Open the Mobile app, and log in with an existent user (it should work) Create a new user, and try to log in to that user (it should work) Now, test that admin/tool/mobile/launch.php works As admin, enable Mobile services and set typeoflogin in Admin/Plugins/Web Service/Mobile to log in via browser and logout Ensure that you are not logged in the site Point your browser to admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc, you should be redirected to /login/index.php, after login in you should be redirected back to admin/tool/mobile/launch.php You must check the previous point using the Network options in your browser developer tool (check that login/index.php is redirecting back to admin/tool/launch.php), admin/tool/mobile/launch.php will try to open a custom url scheme so you will see an empty screen and probably login/index.php still in the url. A good way to test this is in Chrome, enable the developer tools, and then switch to the "Mobile device emulation" tool, is an icon that displays a phone/tablet, then you canselect Iphone or iPad, this will change the user-agent. If you try again the process simulating being a iOs device you will see a screen with a link saying "Please, click here if the app does not open automatically", if you inspect the link you will see that points to moodlemobile://token=A_HEX_TOKEN If you try to launch admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=abc while the mobile services are disabled you will get an error If you try to launch it while type of login is set to via app, you will get an error
    • Affected Branches:
      MOODLE_30_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-53777-master

      Description

      This feature is currently implemented in the Moodle Mobile additional features plugin.

      Enabling login via the browser (or the embedded browser) makes the authentication of the user to be done via the Moodle standard log in form instead the login/token.php script.

      This allow the Mobile app to work in sites using CAS, Shibboleth, LDAP SSO or any Oauth method.

      The process of how it works is the following:

      • When a user enters a URL, the app detects the type of login via the AJAX non-login required WS tool_mobile_get_public_config
      • If the type of login is via browser, the app open a browser pointing to site/admin/tool/launch.php script - if the user is already authenticated this script will generate a token an open via Custom URL schemes the app passing that token
      • If the user is not authentication, the user will be redirected to login/index.php
      • Once the user is authenticated, and thanks to SESSION->wantsurl, the site/admin/tool/launch.php is launched, doing the token generation and app launch

      Please, note that the current version of the mobile app only support this right now via the local_mobile plugin, once this issue is integrated we'll add support in the app. This means that you cannot use the current version of the app to check the whole process.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16