How do you map custom virtual roles in Optimizely CMS 12?

  • Page Owner: Not Set
  • Last Reviewed: 2022-03-17

When integrating SSO (Azure AD, Okta, ect) into a CMS 12, you may need to map third party roles/groups to Optimizely roles so that users can be authenticated within the CMS.


Answer

https://world.optimizely.com/documentation/developer-guides/CMS/security/integrate-azure-ad-using-openid-connect/

I found that by adding the following to the appsettings.json, I could map any role/group name coming from the customers single/multi-tenant environment.

"EPiServer": {
    "Cms": {
      "MappedRoles": {
        "Items": {
          "CmsAdmins": {
            "MappedRoles": [ "WebAdmins", "Administrators", "gp-PHIWEBOPTI-WebAdmins-res" ],
            "ShouldMatchAll": "false"
          },
          "CmsEditors": {
            "MappedRoles": [ "WebEditors", "gp-PHIWEBOPTI-WebEditors-res" ],
            "ShouldMatchAll": "false"
          }
        }
      }
    }
  }
  • MappedRoles is the groups/role that should be mapped to the Items/<VirtualRole> ("CmsAdmins" or "CmsEditors" in this case)

  • ShouldMatchAll indicates if the user has to be in ALL of the MappedRoles (true) or ANY of the MappedRoles (false) in order to be assigned the Items/<VirtualRole>