Custom Authentication Module

Topics: Customizing Orchard, Writing modules
Jul 18, 2012 at 10:59 AM

I want to write a custom authentication module. Our company already has a lot of members, and we have membership cards that has a unique membership number as well as an associated PIN.

Here's a rough workflow:

1.) User enters Membership Number & PIN

2.) Communicate to our servers via an existing API to check if PIN is valid. If not valid, stop.

3.) If valid, and the user already has an Orchard account, continue to profile.

4.) If valid, and the user does not have an Orchard account, retrieve necessary information from our servers to create and populate a new Orchard account.

I can create already create a module. My question is, How do I programatically create an account on Orchard? I'm using my own SQL Server, so I have access to all of the tables- I just don't know which ones to insert information into, as well as any relationships that I need to take care of.

Thanks in advance.

Developer
Jul 23, 2012 at 11:52 AM

You can use MembershipService to create new accounts in Orchard. Have a look at the Orchard.Users module to see exactly how this works.

Coordinator
Jul 23, 2012 at 12:14 PM

As a starting point, you might want to look at other modules performing similar tasks, such as Nick Mayne's OpenAuth module http://gallery.orchardproject.net/List/Modules/Orchard.Module.NGM.OpenAuthentication