Try our conversational search powered by Generative AI!

Search & Navigation problems with virtual roles

Vote:
 

Hi everyone,

I'm having some issues with accessing the search & navigation UI after setting up authentication using OpenID Connect. As expected the menu item was hidden because the role names are different in the new setup. Then I mapped the 'SearchAdmins' role to the new roles, but even though the menu item is now visible nothing happens when clicking it (it appends #global_find_sub to the current URL). When accessing the URL directly (/EPiServer/Find) it redirects to /Account/AccessDenied?ReturnUrl=%2FEPiServer%2FFind — meaning that the current user does not have access.

When I revert the authentication back to use the AddCmsAspNetIdentity then everything works perfectly fine. Hoping that someone here can point me in the right direction.

App settings configuration:

{
  "EPiServer": {
    "Cms": {
      "MappedRoles": {
        "Items": {
          "SearchAdmins": {
            "MappedRoles": [ "MyCustomAdminRole" ]
          }
        }
      }
    },
    "Find": {
      "DefaultIndex": "X",
      "ServiceUrl": "X",
      "TrackingSanitizerEnabled": true,
      "TrackingTimeout": 30000
    }
  }
}

In startup:

services.AddFind();

Sidenote, I don't have the Content Manager installed so when I go to the root URL /episerver it will automatically go to the Search & Navigation UI (after login if I'm not already logged in). This doesn't make any sense to me and I was confused as to why this request returned access denied. Is it possible to change this to redirect to CMS/Edit instead?

#283984
Edited, Jul 20, 2022 6:51
Vote:
 

The solution was to also add a role mapping for FindAdmins:

"SearchAdmins": {
  "MappedRoles": [ "MyCustomAdminRole" ]
},
"FindAdmins": {
  "MappedRoles": [ "MyCustomAdminRole" ]
}

Another option:

services.Configure<VirtualRoleOptions>(options =>
{
    options.AddMappedRole("FindAdmins", "MyCustomAdminRole");
});

There does not seem to be any documentation whatsoever regarding role configurations or the VirtualRoleOptions, FindUIOptions and AuthorizationOptions options. I will submit feedback to the documentation so that this can be added/improved.

#284352
Edited, Jul 25, 2022 6:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.