MCV4 Security

3 posts, 0 answers
  1. gmendez
    gmendez avatar
    82 posts
    Member since:
    Jun 2012

    Posted 01 Sep 2014 Link to this post

    Hi Telerik,

    I would like to use Data Access in an MVC4 project. I would like to be able to use all the functionality of the .Net class WebMatrix.WebData.WebSecurity for handling everything related to membership and roles. However these classes uses EntityFramework for creating and accessing the security related tables. I would like to use OpenAccess instead. Is there a means comming out of the box in Data Access of handling these security aspects? Is there an example at least?
    I would like to have the user and role related classes in an openaccess data model and handle everything the same way.
    Is it possible at all?
    Thanks in advance

    Gonzalo.
  2. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 04 Sep 2014 Link to this post

    Hello gonzalo,

    Yes, this is possible. In order to do that you need to:

    1. Implement custom membership provider. As WebMatrix.WebData.WebSecurity use an instance of ExtendedMembershipProvider class your custom provider need to derive from this class and implement its abstract methods (or a subset of methods that is required for your scenario). This is where you could use Telerik Data Access to access the database to manage the users related tables.
    2. Plug the your provider in your MVC project. This is done through adding configurations in the web.config.

    Please refer to this blog post which demonstrates the approach. Please note in demonstrated scenario the custom membership provider actually derives from the MembershipProvider class (step 3). In your case please use the ExtendedMembershipProvider. This also means that you should skip step 9.

    Also I think you may find interesting this blog post which described in greater detail the membership mechanism used in the MVC4 projects. 

    Unfortunately, we do not have a sample that shows how to implement custom membership provider using  Telerik Data Access. If you are interested in such sample and documentation, please post a documentation request in our Ideas & Feedback portal. Voting for it would help us prioritize it.

    I hope this is helpful. Let us know if you have any further questions.

    Regards,
    Boyan
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. gmendez
    gmendez avatar
    82 posts
    Member since:
    Jun 2012

    Posted 05 Sep 2014 in reply to Boyan Link to this post

    Hi!!! Thanks for your kind response. After asking here I found one of the forum posts you mentioned.
    Anyway, for my case this approach is to much, like "killing a fly with a machine gun". 
    Cheers!!

    Gonzalo
Back to Top