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

OAuth2 field mappings don't allow to choose internal profile fields

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_39_STABLE
    • master_MDL-61789
    • Hide
      1. Create a user profile field (Site administration > users > User profile fields
        1. Make the field a text input
        2. Give the field a name and short name. Other fields can have their defaults
      2. Enable OAuth2 authentication plugin (Site administration > plugins > manage authentication)
      3. Set up an OAuth2 issuer
        1. Setting up OAuth2 can be tricky, it is recommended to review the documentation here: https://docs.moodle.org/311/en/OAuth_2_services)
        2. Setup a Microsoft provider, using the guide here: https://docs.moodle.org/311/en/OAuth_2_Microsoft_service (It doesn't have to be MS, but it is one of the easier ones to setup, and it allows "localhost")
        3. When setting up the OAuth2 provider unselect the "Require email validation" checkbox. (This makes testing steps easier)
      4. Once the issuer is setup, go to the field mapping for the issuer and click the "Create new field mapping for issuer" button
      5. In the "External field name" field add a field that is being sent by the OAuth2 issuer
        • Note: Depending on what data you set on the provider side will depend on what fields you have available. In my testing I used the country field from the provider and mapped it to the custom profile field in Moodle
        • Note: Also currently in Moodle if you map a single source field from the provider to multiple Moodle fields, only the last one is applied.
      6. From the select dropdown for the "Internal field name" select the custom user profile field you created
      7. Log out as the administrator
      8. Log in with an  OAuth2 test account.
      9. Go to Profile / Edit Profile (YOu may need to log out as the test user and log back in as an administrator
      10. On the Edit profile page under the additional custom profile fields, you should see the value from the OAuth2 provider mapped.
      Show
      Create a user profile field (Site administration > users > User profile fields Make the field a text input Give the field a name and short name. Other fields can have their defaults Enable OAuth2 authentication plugin (Site administration > plugins > manage authentication) Set up an OAuth2 issuer Setting up OAuth2 can be tricky, it is recommended to review the documentation here: https://docs.moodle.org/311/en/OAuth_2_services) Setup a Microsoft provider, using the guide here: https://docs.moodle.org/311/en/OAuth_2_Microsoft_service (It doesn't have to be MS, but it is one of the easier ones to setup, and it allows "localhost") When setting up the OAuth2 provider unselect the "Require email validation" checkbox. (This makes testing steps easier) Once the issuer is setup, go to the field mapping for the issuer and click the "Create new field mapping for issuer" button In the "External field name" field add a field that is being sent by the OAuth2 issuer Note: Depending on what data you set on the provider side will depend on what fields you have available. In my testing I used the country field from the provider and mapped it to the custom profile field in Moodle Note: Also currently in Moodle if you map a single source field from the provider to multiple Moodle fields, only the last one is applied. From the select dropdown for the "Internal field name" select the custom user profile field you created Log out as the administrator Log in with an  OAuth2 test account. Go to Profile / Edit Profile (YOu may need to log out as the test user and log back in as an administrator On the Edit profile page under the additional custom profile fields, you should see the value from the OAuth2 provider mapped.
    • 5

    Description

      When mapping user attributes from auth server to moodle internal database only basic user fields can be set. There is no way to map values to custom profile fields defined by admin.

      These fields are many times meant to serve this purpose eg. hold a user's attribute synced from other system.

      Attachments

        Issue Links

          Activity

            People

              mattp@catalyst-au.net Matt Porritt
              mastnym Martin Mastny
              Guillermo Gomez Arias Guillermo Gomez Arias
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              19 Vote for this issue
              Watchers:
              31 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 2 minutes
                  4h 2m