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

Add Javascript API in Safe Exam Browser (SEB) integration to query the keys (BEK/CK)

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • MDL-72188-master_seb_js_integration-with-message
    • Hide

      Setup

      The following tests should be run on at least the Mac OS and Windows platforms.

      Notes

      • SEB == Safe Exam Browser, going forward.
      • By default SEB requires the application to be run on a computer with a single built-in screen. This is configurable, but there is currently a bug in the Windows version that does not allow a computer with external screens only (i.e. a Tower), so it's recommended to test on a laptop without any other screens plugged in.

      Install SEB

      1. On Mac
      2. On Windows

      Site setup

      1. Log in as an admin.
      2. Navigate to Site administration -> Plugins -> Activity modules -> Safe Exam Browser templates
      3. Click 'Add new template'
      4. Set new template name to 'Test template'
      5. Upload an unencrypted seb config file. Either use the one attached to the tracker (SebClientSettings.seb) or generate one using the Safe Exam Browser config tool.
      6. Set Enabled to 'Yes'.
      7. Click 'Save changes'.
      8. Create a test user.
      9. Create a test course.
      10. Enrol a test user in the test course in the 'student' role.

      Setup - SEB Manual config

      1. In the test course, create a quiz.
      2. Give the quiz the name 'SEB quiz - Manual'.
      3. In quiz settings, go to the Safe Exam Browser section.
      4. Set 'Require the use of Safe Exam Browser' to 'Configure manually'.
      5. Save the quiz settings.
      6. Add a question to the quiz.

      Setup - SEB Template config

      1. Go back to the course homepage with editing mode on.
      2. Duplicate the quiz and give it the name 'SEB quiz - Template'
      3. Edit the quiz settings, and go to the Safe Exam Browser section.
      4. Set 'Require the use of Safe Exam Browser' to 'Yes - Use an existing template'.
      5. For setting 'Safe Exam Browser config template', select the template 'Test template'
      6. Save the quiz settings.

      Setup - SEB Upload config

      1. Go back to the course homepage with editing mode on.
      2. Duplicate the quiz and give it the name 'SEB quiz - Upload config'
      3. Edit the quiz settings, and go to the Safe Exam Browser section.
      4. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'.
      5. Upload an unencrypted seb config file. Either use the one attached to the tracker (SebClientSettings.seb) or generate one using the Safe Exam Browser config tool.
      6. Save the quiz settings.

      Setup - SEB Client config

      1. Go back to the course homepage with editing mode on.
      2. Duplicate the quiz and give it the name 'SEB quiz - Client config'
      3. In quiz settings, go to the Safe Exam Browser section.
      4. Set 'Require the use of Safe Exam Browser' to 'Yes - Use client config'.
      5. Save the quiz settings.

      Setup - SEB Upload config - Invalid key

      1. Go back to the course homepage with editing mode on.
      2. Duplicate the 'SEB quiz - Upload config' quiz and give it the name 'SEB quiz - Upload config invalid key'
      3. Edit the quiz settings, and go to the Safe Exam Browser section.
      4. Add random key to "Allowed browser exam keys". E.g. 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
      5. Save the quiz settings.

      Test scenarios

      Test quiz access with 'Configure manually' SEB settings

      1. Open Moodle in a regular web browser (E.g. Firefox, Chrome)
      2. Log in as the test user.
      3. Go to test course
      4. Go to test quiz: 'SEB quiz - Manual'
      5. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      6. You should see a button with the label: "Launch Safe Exam Browser"
      7. Click on "Launch Safe Exam Browser"
      8. Confirm to open the link via Safe Exam Browser
      9. On the SEB window, log in as a test user.
        • On Windows, the SEB reloads after logging in and you will have to log in again.
      10. You should see the quiz landing page
      11. (Mac only) You should see an alert with the message: "Checking access to Safe Exam Browser..."
      12. (Mac only) After a short delay, the page should reload.
      13. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      14. You should see a button with the label: 'Attempt quiz'
      15. Click on 'Attempt quiz'
      16. You should see the first question on the quiz.
      17. Close the SEB window via the power button icon on the lower right-hand corner of the window.

      Test quiz access with 'Use an existing template' SEB settings

      1. Go back to the regular web browser window. You may need to reload the page.
      2. Go to test quiz: 'SEB quiz - Template'
      3. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      4. You should see a button with the label: "Launch Safe Exam Browser"
      5. Click on "Launch Safe Exam Browser"
      6. Confirm to open the link via Safe Exam Browser
      7. Log in as a test user.
        • On Windows, the SEB reloads after logging in and you will have to log in again.
      8. You should see the quiz landing page
      9. (Mac only) You should see an alert with the message: "Checking access to Safe Exam Browser..."
      10. (Mac only) After a short delay, the page should reload.
      11. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      12. You should see a button with the label: 'Attempt quiz'
      13. Click on 'Attempt quiz'
      14. You should see the first question on the quiz.
      15. Close the SEB window

      Test quiz access with 'Upload my own config' SEB settings

      1. Go back to the regular web browser window. You may need to reload the page.
      2. Go to test quiz: 'SEB quiz - Upload config'
      3. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      4. You should see a button with the label: "Launch Safe Exam Browser"
      5. Click on "Launch Safe Exam Browser"
      6. Confirm to open the link via Safe Exam Browser
      7. Log in as a test user.
        • On Windows, the SEB reloads after logging in and you will have to log in again.
      8. You should see the quiz landing page
      9. (Mac only) You should see an alert with the message: "Checking access to Safe Exam Browser..."
      10. (Mac only) After a short delay, the page should reload.
      11. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      12. You should see a button with the label: 'Attempt quiz'
      13. Click on 'Attempt quiz'
      14. You should see the first question on the quiz.
      15. Close the SEB window

      Test quiz access with 'Use SEB client config' SEB settings

      1. Go back to the regular web browser window. You may need to reload the page.
      2. Go to test quiz: 'SEB quiz - Client config'
      3. You should see the message: "This quiz has been configured to use the Safe Exam Browser with client configuration."
      4. You should NOT see a button with the label: "Launch Safe Exam Browser"
      5. (Mac) client configuration
        1. Open SEB
        2. Open Menu > Preferences
        3. On the General tab:
          • Set the Start URL to the quiz's URL
          • Set a quit password (e.g. just use 'quit')
        4. On Config File tab:
          • "Use config file for..." to "configuring clients"
          • Save and restart SEB
        5. Confirm SEB loads the site's login page.
      6. (Windows) client configuration
        1. Open the start menu
        2. Open the SEB Configuration Utility
        3. On the General tab:
          • Set the Start URL to the quiz's URL
          • Set a quit password (e.g. just use 'quit')
        4. On Config File tab:
          • "Use config file for..." to "configuring clients"
          • Press "Configure Client"
        5. Launch the Safe Exam Browser
      7. Log in as a test user.
      8. You should see the quiz landing page
      9. You should no longer see the message: "This quiz has been configured to use the Safe Exam Browser with client configuration."
      10. You should see a button with the label: 'Attempt quiz'
      11. Click on 'Attempt quiz'
      12. You should see the first question on the quiz.
      13. Close the SEB window

      Test quiz access denied with 'Upload my own config'

      1. Go back to the regular web browser window. You may need to reload the page.
      2. Go to test quiz: 'SEB quiz - Upload config invalid key'.
      3. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      4. You should see a button with the label: "Launch Safe Exam Browser"
      5. Click on "Launch Safe Exam Browser"
      6. Confirm to open the link via Safe Exam Browser
        • On Windows, the SEB reloads after logging in and you will have to log in again.
      7. You should see the quiz landing page
      8. You should see an alert with the message: "Checking access to Safe Exam Browser..."
      9. After a short delay, the page should reload.
      10. You should see a modal pop-up message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      11. Once you close the modal, you should NOT see a button with the label: 'Attempt quiz'
      12. Close the SEB window

      Test with an old version of SEB that doesn't support JS API

      1. Install a Safe Exam Browser application that supports config keys but not the JS API.
      2. Go back to the regular web browser window. You may need to reload the page.
      3. Go to test quiz: 'SEB quiz - Upload config'
      4. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      5. You should see a button with the label: "Launch Safe Exam Browser"
      6. Click on "Launch Safe Exam Browser"
      7. Log in as a test user.
      8. You should see the quiz landing page
      9. You should not see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file."
      10. You should see a button with the label: 'Attempt quiz'
      11. Click on 'Attempt quiz'
      12. You should see the first question of the quiz.
      Show
      Setup The following tests should be run on at least the Mac OS and Windows platforms. Notes SEB == Safe Exam Browser, going forward. By default SEB requires the application to be run on a computer with a single built-in screen. This is configurable, but there is currently a bug in the Windows version that does not allow a computer with external screens only (i.e. a Tower), so it's recommended to test on a laptop without any other screens plugged in. Install SEB On Mac Download and install SEB Mac 3.1 . On Windows Download and install SEB Windows 3.3.2 or up Site setup Log in as an admin. Navigate to Site administration -> Plugins -> Activity modules -> Safe Exam Browser templates Click 'Add new template' Set new template name to 'Test template' Upload an unencrypted seb config file. Either use the one attached to the tracker ( SebClientSettings.seb ) or generate one using the Safe Exam Browser config tool. Set Enabled to 'Yes'. Click 'Save changes'. Create a test user. Create a test course. Enrol a test user in the test course in the 'student' role. Setup - SEB Manual config In the test course, create a quiz. Give the quiz the name ' SEB quiz - Manual '. In quiz settings, go to the Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Configure manually'. Save the quiz settings. Add a question to the quiz. Setup - SEB Template config Go back to the course homepage with editing mode on. Duplicate the quiz and give it the name ' SEB quiz - Template ' Edit the quiz settings, and go to the Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Use an existing template'. For setting 'Safe Exam Browser config template', select the template 'Test template' Save the quiz settings. Setup - SEB Upload config Go back to the course homepage with editing mode on. Duplicate the quiz and give it the name ' SEB quiz - Upload config ' Edit the quiz settings, and go to the Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Upload my own config'. Upload an unencrypted seb config file. Either use the one attached to the tracker ( SebClientSettings.seb ) or generate one using the Safe Exam Browser config tool. Save the quiz settings. Setup - SEB Client config Go back to the course homepage with editing mode on. Duplicate the quiz and give it the name ' SEB quiz - Client config ' In quiz settings, go to the Safe Exam Browser section. Set 'Require the use of Safe Exam Browser' to 'Yes - Use client config'. Save the quiz settings. Setup - SEB Upload config - Invalid key Go back to the course homepage with editing mode on. Duplicate the ' SEB quiz - Upload config ' quiz and give it the name ' SEB quiz - Upload config invalid key ' Edit the quiz settings, and go to the Safe Exam Browser section. Add random key to " Allowed browser exam keys ". E.g. 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 Save the quiz settings. Test scenarios Test quiz access with 'Configure manually' SEB settings Open Moodle in a regular web browser (E.g. Firefox, Chrome) Log in as the test user. Go to test course Go to test quiz: ' SEB quiz - Manual ' You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Confirm to open the link via Safe Exam Browser On the SEB window, log in as a test user. On Windows, the SEB reloads after logging in and you will have to log in again. You should see the quiz landing page (Mac only) You should see an alert with the message: " Checking access to Safe Exam Browser... " (Mac only) After a short delay, the page should reload. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: 'Attempt quiz' Click on 'Attempt quiz' You should see the first question on the quiz. Close the SEB window via the power button icon on the lower right-hand corner of the window. Test quiz access with 'Use an existing template' SEB settings Go back to the regular web browser window. You may need to reload the page. Go to test quiz: ' SEB quiz - Template ' You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Confirm to open the link via Safe Exam Browser Log in as a test user. On Windows, the SEB reloads after logging in and you will have to log in again. You should see the quiz landing page (Mac only) You should see an alert with the message: " Checking access to Safe Exam Browser... " (Mac only) After a short delay, the page should reload. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: 'Attempt quiz' Click on 'Attempt quiz' You should see the first question on the quiz. Close the SEB window Test quiz access with 'Upload my own config' SEB settings Go back to the regular web browser window. You may need to reload the page. Go to test quiz: ' SEB quiz - Upload config ' You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Confirm to open the link via Safe Exam Browser Log in as a test user. On Windows, the SEB reloads after logging in and you will have to log in again. You should see the quiz landing page (Mac only) You should see an alert with the message: " Checking access to Safe Exam Browser... " (Mac only) After a short delay, the page should reload. You should no longer see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: 'Attempt quiz' Click on 'Attempt quiz' You should see the first question on the quiz. Close the SEB window Test quiz access with 'Use SEB client config' SEB settings Go back to the regular web browser window. You may need to reload the page. Go to test quiz: ' SEB quiz - Client config ' You should see the message: "This quiz has been configured to use the Safe Exam Browser with client configuration." You should NOT see a button with the label: "Launch Safe Exam Browser" (Mac) client configuration Open SEB Open Menu > Preferences On the General tab: Set the Start URL to the quiz's URL Set a quit password (e.g. just use 'quit') On Config File tab: "Use config file for..." to "configuring clients" Save and restart SEB Confirm SEB loads the site's login page. (Windows) client configuration Open the start menu Open the SEB Configuration Utility On the General tab: Set the Start URL to the quiz's URL Set a quit password (e.g. just use 'quit') On Config File tab: "Use config file for..." to "configuring clients" Press " Configure Client " Launch the Safe Exam Browser Log in as a test user. You should see the quiz landing page You should no longer see the message: "This quiz has been configured to use the Safe Exam Browser with client configuration." You should see a button with the label: 'Attempt quiz' Click on 'Attempt quiz' You should see the first question on the quiz. Close the SEB window Test quiz access denied with 'Upload my own config' Go back to the regular web browser window. You may need to reload the page. Go to test quiz: ' SEB quiz - Upload config invalid key '. You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Confirm to open the link via Safe Exam Browser On Windows, the SEB reloads after logging in and you will have to log in again. You should see the quiz landing page You should see an alert with the message: "Checking access to Safe Exam Browser..." After a short delay, the page should reload. You should see a modal pop-up message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." Once you close the modal, you should NOT see a button with the label: 'Attempt quiz' Close the SEB window Test with an old version of SEB that doesn't support JS API Install a Safe Exam Browser application that supports config keys but not the JS API. Mac: SEB mac 2.3.2 Windows: SEB windows 3.3.1 Go back to the regular web browser window. You may need to reload the page. Go to test quiz: ' SEB quiz - Upload config ' You should see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: "Launch Safe Exam Browser" Click on "Launch Safe Exam Browser" Log in as a test user. You should see the quiz landing page You should not see the message: "The config key or browser exam keys could not be validated. Please ensure you are using the Safe Exam Browser with correct configuration file." You should see a button with the label: 'Attempt quiz' Click on 'Attempt quiz' You should see the first question of the quiz.

      This tracker created based on danschlet message in in a Telegram channel.

      In new macOS and iOS versions of SEB. There are/will support the modern WebKit browser engine (the WKWebView API), which has many advantages. It increases performance, stability and compatibility with web applications. Very important: Is supports access to camera/microphone via WebRTC (getUserMedia etc.). Unfortunately Apple decided to not allow to add custom headers to HTTP request. Therefore we need another way how to transmit the ConfigKey and BrowserExamKey hashes to the assessment web application.

      From version 3.0 for IOS SEB supports JavaScript API which allows to query app version details, and the ConfigKey and BrowserExamKey security elements. It is inspired by the Smarter Balanced Assessment Consortium Secure Browser API Specification (https://github.com/SmarterApp/SB_BIRT/blob/master/irp/doc/req/SecureBrowserAPIspecification.md )

      Currently the current request header transmission of the CK/BEK is still supported, if sending the CK/BEK is enabled, then the classic WebView is used. But to profit from the benefits of the modern WKWebView in the main browser tab where Moodle is displayed, it would be necessary to support the new SEB JS API for querying the CK/BEK as well.

      There are some discussions

       

      Thoughts about the steps to support the SEB JS API in Moodle (on an abstract level):

      1. Support both the HTTP header check and the JavaScript API for the ConfigKey (and if required for the BrowserExamKey BEK). As mentioned, the keys will be same for the same web page (URL). So the web application can check for the availability of the SafeExamBrowser.security.updateKeys() function (or the SafeExamBrowser.version variable). If it‘s available, then the JavaScript API is supported and you can get the ConfigKey/BEK from it. Otherwise get the ConfigKey/BEK from the HTTP headers.
      2. In the SEB configuration generated by Moodle, set the SEB settings key browserWindowWebView to the policy "Prefer Modern" (integer value 3), which will force the use of the modern WebView and the Javascript API in SEB versions where it is available. 

            dmitriim Dmitrii Metelkin
            dmitriim Dmitrii Metelkin
            Dmitrii Metelkin Dmitrii Metelkin
            Jun Pataleta Jun Pataleta
            Jun Pataleta Jun Pataleta
            Votes:
            3 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours, 36 minutes
                1d 5h 36m

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