SF 5.1 - MVC Page using Authorize and specifying Roles alway

Posted by Community Admin on 04-Aug-2018 04:59

SF 5.1 - MVC Page using Authorize and specifying Roles always fails Authentication.

All Replies

Posted by Community Admin on 04-Oct-2012 00:00

Hi,
We have been playing around with the MVC pages and are having problems trying to get the RoleManager to work with Sitefinity.
We have a Controller similar to so:

[Authorize(Roles="Users")]
public class TestController : Controller ....

We are using an active directory RoleManager but I have also tried to use the Sitefinity rolemanager by adding the following to the web.config:
<roleManager enabled="true" defaultProvider="Default">
      <providers>
        <clear />
        <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityRoleProvider, Telerik.Sitefinity" />
      </providers>
    </roleManager>

For the custom RoleProvider even if the overriding function: GetRolesForUser(username) returns a list of Roles that has "Users" in it, Sitefinity keeps redirecting me to the Authentication page. The same occurs if I use the Sitefinity RoleProvider as specified above in the web.config.

Has anyone been able to get this to work in their MVC controllers or am I doing this the wrong way?

Posted by Community Admin on 31-Oct-2012 00:00

For the sake of closing this issue. I had incorrectly setup my ldaprole manager.....
Never the less! Using the authorize attribute when specifying roles works as expected.

This thread is closed