0
votes

I'm in a bit of a pickle here. I want to authenticate users through LDAP and automatically create accounts for users when they log in for the first time.

So far I've created a custom membership provider & I'm able to log in with my LDAP credentials. The next step I have in mind is to capture the username and store it in the local database, thus creating a new user. Problem is, the CreateUser method requires database items that I don't need such as 'IsApproved' or 'IsLockedOut'. I also don't want to store user passwords if possible and authenticate directly with the LDAP store.

To cut to the chase, which would be the best option?

  1. Stick to the current custom membership provider & have additional database fields that I don't require
  2. Implement custom membership user + custom membership provider (the long route)
  3. IPrincipal & IIdentity?

Any feedback would be appreciated. Thanks!

p.s. I'm using EF Code First with MVC 4.

1
This is a really bad idea. You will create a new account on every typo when logging in.user207421
Here is an example of a custom membership provider with custom DB schema built on top of Entity Framework, SSDT github.com/kriasoft/site-sdkGrief Coder
Thanks Grief Coder, that seems like a great starter kit. Too bad I'm on VS2010.nouptime

1 Answers

0
votes

I've already managed to figure it out. I decided to use the default database fields, stuck with the custom provider and used the CreateUser method to add new users to the database.