volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

Virtual role addition for ContentDeliveryAPI

As per the documentation I have set up the Content delivery API . As suggested I have added the virtual role:

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="Everyone" mode="Any" />

With above line when role is set to Everyone the Content delivery API response is coming up fine. However when I assign a role

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="Everyone" mode="CMSAdmins MyRole1 MyRole2 MyRoleGroup1" />

The Id i used to login to the site is having CMSAdmins as the role but Content Delivery API responsds with Forbidden. 

What am I missing here ?

#217983
Mar 03, 2020 21:31

It looks like you have assigned the roles to the 'mode' attribute rather than the 'roles' one. Keep 'mode' as 'Any' and replace 'Everyone' with your role list. 

#218192
Mar 06, 2020 23:23

Sorry about that. It was a typo but I have mode as Any and roles of what it should be.

#218265
Mar 09, 2020 21:20

Do you mean that it was a typo in your question or in your web.config? Also, are the roles separated by comma?

<add name="contentapiread" type="EPiServer.Security.MappedRole, EPiServer.Framework" roles="CMSAdmins, MyRole1, MyRole2, MyRoleGroup1" mode="Any" />
#218266
Mar 09, 2020 21:36

Sorry for any confusion. It was typo in my question. My web.config is correct as per the documentation and as you have mentioned above.

#218289
Mar 10, 2020 13:35
Vote:

This turned out to be issue with authorization where claims were not be set correctly.

#219257
Apr 01, 2020 0:14
error 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.