+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / SF 5.1 - MVC Page using Authorize and specifying Roles always fails Authentication.

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

2 posts, 0 answered
  1. Joel
    Joel avatar
    6 posts
    Registered:
    22 Aug 2012
    04 Oct 2012
    Link to this post
    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?

  2. Joel
    Joel avatar
    6 posts
    Registered:
    22 Aug 2012
    31 Oct 2012 in reply to Joel
    Link to this post
    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.
2 posts, 0 answered