This is a migrated thread and some comments may be shown as answers.

MCV4 Security

2 Answers 52 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gmendez
Top achievements
Rank 1
gmendez asked on 02 Sep 2014, 12:05 AM
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 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 04 Sep 2014, 06:47 AM
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.
 
0
gmendez
Top achievements
Rank 1
answered on 05 Sep 2014, 01:44 PM
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
Tags
Development (API, general questions)
Asked by
gmendez
Top achievements
Rank 1
Answers by
Boyan
Telerik team
gmendez
Top achievements
Rank 1
Share this question
or