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

Login screens can be disallowed for oauth - need to force a popup with embedded resources

XMLWordPrintable

    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-59008-master
    • Hide
      Pre-requisites

      To test this issue make sure you have google API details and your moodle instance is configured to use OAuth2 authentication and services. Also Google drive and OneDrive repositories will be necessary (yes, the whole thing).
      Also, it is necessary to have two different accounts, one for the system account and the other to actually test the bug.

      Setup

      1. If you don't have Google API and OneDrive API client secret and key, follow the steps on this doc page to create your id.
      2. Please note: Microsoft requires https, so you need to edit your config.php and set $CFG->wwwroot to https:

        $CFG->wwwroot   = 'https://yourserver.per.in.moodle.com/integration_master';
        

      3. Go to Site administration > Plugins > Authentication > Manage authentication
      4. Enable Oauth2 auth plugin.
        # Go to Site administration > Server > OAuth 2 services
      5. Click on Create new Google service button
      6. On the form enter your Client Id and Client Secret and save.
      7. Click on the door icon, on the System account connected column.
      8. Make sure you system account gets connected.
      9. Click on Create new Microsoft service button
      10. On the form enter your Client Id and Client Secret and save.
      11. Click on the door icon, on the System account connected column.
      12. Make sure you system account gets connected.
      13. Go to Site administration > Plugins > Repositories > Manage repositories
      14. Enable and make Google Drive repository visible and then click Settings.
      15. On the Oauth2 service field set Google, set Supported files and Default return type fields to External (only links stored in Moodle) and save.
      16. Enable and make Microsoft OneDrive repository visible and then click Settings.
      17. On the Oauth2 service field set Microsoft, set Supported files and Default return type fields to External (only links stored in Moodle) and save.
      Test
      1. Open a incognito window.
      2. Log in as admin
      3. Go to a course, turn edit mode on and click to add a resource (File).
      4. On the form, click to add a file.
      5. On the file picker, select Google drive
      6. Click on the button to log in and enter your login and password.
        • Make sure it works fine, you log in and see the files on your repository.
      7. Select an presentation file.
      8. Expand Appearance tab and select Embed on display field.
      9. Click save and display.
      10. You should see the file without problems.
      11. Now, close this window and open another incognito window.
      12. Log in as admin again (do not log in using google account) and go to that file again.
      13. Note the Iframe now displays a blank page with a link Login to your account because you are not logged in any more.
      14. Click on the link and do the login steps (username and password).
      15. Make sure the pop-up window closes and the parent window (the one with the resource) gets reloaded.
      16. Make sure the presentation is displayed after the page reload.
      17. Try changing the file's display to 'In a pop up' run through the oauth login process in the popup. Note: you may need to sign out from google and create a new session in Moodle to trigger the google login. Check in particular that no alerts or warnings are displayed, and that once logged in to google, the file can be viewed in the popup.
      18. Again, change the file's display to each of 'Open' and 'Download' and confirm that accessing the file through these flows is working as on stables.
      19. Repeat test above using one drive repository.
      Show
      Pre-requisites To test this issue make sure you have google API details and your moodle instance is configured to use OAuth2 authentication and services . Also Google drive and OneDrive repositories will be necessary (yes, the whole thing). Also, it is necessary to have two different accounts , one for the system account and the other to actually test the bug. Setup If you don't have Google API and OneDrive API client secret and key, follow the steps on this doc  page to create your id. Please note: Microsoft requires https, so you need to edit your config.php and set $CFG->wwwroot to https: $CFG->wwwroot = 'https://yourserver.per.in.moodle.com/integration_master'; Go to Site administration > Plugins > Authentication > Manage authentication Enable Oauth2 auth plugin. # Go to Site administration > Server > OAuth 2 services Click on Create new Google service button On the form enter your Client Id and Client Secret and save. Click on the door icon, on the System account connected column. Make sure you system account gets connected. Click on Create new Microsoft service button On the form enter your Client Id and Client Secret and save. Click on the door icon, on the System account connected column. Make sure you system account gets connected. Go to Site administration > Plugins > Repositories > Manage repositories Enable and make Google Drive repository visible and then click Settings. On the Oauth2 service field set Google, set Supported files and Default return type fields to External (only links stored in Moodle) and save. Enable and make Microsoft OneDrive repository visible and then click Settings. On the Oauth2 service field set Microsoft, set Supported files and Default return type fields to External (only links stored in Moodle) and save. Test Open a incognito window. Log in as admin Go to a course, turn edit mode on and click to add a resource (File). On the form, click to add a file. On the file picker, select Google drive Click on the button to log in and enter your login and password. Make sure it works fine, you log in and see the files on your repository. Select an presentation file. Expand Appearance tab and select Embed on display field. Click save and display. You should see the file without problems. Now, close this window and open another incognito window. Log in as admin again (do not log in using google account) and go to that file again. Note the Iframe now displays a blank page with a link Login to your account because you are not logged in any more. Click on the link and do the login steps (username and password). Make sure the pop-up window closes and the parent window (the one with the resource) gets reloaded. Make sure the presentation is displayed after the page reload. Try changing the file's display to 'In a pop up' run through the oauth login process in the popup. Note: you may need to sign out from google and create a new session in Moodle to trigger the google login. Check in particular that no alerts or warnings are displayed, and that once logged in to google, the file can be viewed in the popup. Again, change the file's display to each of 'Open' and 'Download' and confirm that accessing the file through these flows is working as on stables. Repeat test above using one drive repository.

      When initiating an OAuth login for a resource, we need to detect if a popup is required because we are in an iframe.

            lameze Simey Lameze
            damyon Damyon Wiese
            Damyon Wiese Damyon Wiese
            Jake Dallimore Jake Dallimore
            Andrew Lyons Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.