fantastic work!..but a few bugs

Mar 23, 2013 at 11:17 PM
This is a good effort. I have started implementing it. I was hoping the default UserId was a Mongo.Bson.ObjectId rather than a long type.

In addition, I had to add the 'type' key on to the example config to make it work as it kept 'failing to load the assembly type':

<system.web>
<membership defaultProvider="MongoMembershipProvider">
  <providers>
    <clear />
    <add name="MongoMembershipProvider" type="ExtendedMongoMembership.MongoMembershipProvider, ExtendedMongoMembership" connectionStringName="mongoMembershipDb" />
  </providers>
</membership>
<roleManager enabled="true" defaultProvider="MongoRoleProvider">
  <providers>
    <clear />
    <add name="MongoRoleProvider" type="ExtendedMongoMembership.MongoRoleProvider, ExtendedMongoMembership" connectionStringName="mongoMembershipDb" />
  </providers>
</roleManager>
</system.web>
Mar 24, 2013 at 12:44 AM
Edited Mar 24, 2013 at 1:21 AM
Found another possible bug:

Roles.DeleteRole("testrole_351"); <-- throws an error

NotSupportedException - Unable to determine the serialization information for the expression: Enumerable.Where<MembershipRole>(u.Roles, (MembershipRole r) => (r.RoleName == "testrole_351")).

Has this solution had a full test suite ran against all the inbuilt functions in 'System.Web.Security'?...I've just spent all week replacing my current solution so it could use this :(

......20mins later

Membership.CreateUser("testuser", "testpass"); <--- NotSupportedException-Specified method is not supported

Maybe I'm doing something wrong?
Coordinator
Mar 24, 2013 at 8:43 AM
Edited Mar 24, 2013 at 8:45 AM
Hello,

Thanks very much for contacting me. I would try to help you with this.
One by one
  1. Roles.DeleteRole("testrole_351"); <-- throws an error . I will take a look and fix if anything wrong
  2. Membership.CreateUser("testuser", "testpass"); <--- NotSupportedException-Specified method is not supported. This is right. This is implementation of new ExtendedMembershipProvider for ASP.NET MVC4. To use it power you need to work with WebSecurity class(instead of Membership). More reference here http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
  3. Thanks for pointing to error in my docs
  4. It uses int as id b/c new membership provider requires that.
Please let me know if you need more assistance.

Regards,
Dmitriy
Mar 24, 2013 at 4:49 PM
Edited Mar 24, 2013 at 4:55 PM
Thanks for getting back to me so quickly and the link, Dmitriy.

I'm actually trying to implement your solution into a very basic WCF service (something with username authentication using only basicHttpBinding) but I'm having difficulty. I can see the example solution uses MVC and initializes in the startup but I'm not sure where to place the initialization in a WCF. I know this is very cheeky but do you have a very basic WCF example?

_You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in an AppStart.cshtml file in the root of your site. Source = WebMatrix.WebData
Coordinator
Mar 24, 2013 at 8:53 PM
Hello,

I have fixed delete role method. You can get it from latest commit or nuget.

You dont needd to call WebSecurity.InitializeDatabaseConnection b/c we use mongodb and it makes things easier. I dont understand what exactly you want with wcf.

BTW: Standard Membership configuration site will not work any more with new membership provider and with this one as well.

Regards,
Dmitriy.
Mar 28, 2013 at 1:00 AM
Edited Mar 28, 2013 at 1:39 AM
Thanks for update Dimtriy.

I'm trying to get ASP.Net Forms Authentication working in my WCF (http://www.kotancode.com/2010/08/06/aspnet-authentication-wp7/)...I'm just experimenting...think I will try with ServiceStack later :P

• In your downloadable zip file, the App_Data folder is corrupt and the Samples project is unable to load. I just deleted and recreated this folder. (Maybe its my extraction process using peazip that's breaking it).

• Also, using the sample project: if I attempt to login with a registered user but with incorrect password then it should update the 'LastPasswordFailureDate' field but at the moment it's updating the 'LastLoginDate' field - not correct - user login failed and so did not login successfully.

• line 702 in SimpleMongoProvider.cs : failure.PasswordFailuresSinceLastSuccess != null........ integers can never be nulls (maybe i missed something here)?

Anyway, I will keep you posted on anything interesting that I may discover whilst using your wonderful solution. BTW: this man has done lots of interesting stuff with SimpleMembership (web api authentication, decoupling layers, email confirmation, etc) but not Mongo'd it: http://kevin-junghans.blogspot.co.uk
Mar 28, 2013 at 1:06 AM
Must be your extraction tool or your download.
I just downloaded it and it extracted without errors.
Coordinator
Mar 28, 2013 at 6:49 AM
Edited Apr 1, 2013 at 6:44 AM
Hello,
  • I have just downloaded sources and everything worked fine as NTTAKR stated as well.
  • Thanks again for pointing to bug. Will fix it today
Very much thanks for your help(I think we are close to first release). I have took a look at Кеvin's blog, looks impressive. How do you think what is more important for version 2: add permissions or add some admin interface for managing users and roles (something like)?

Thanks, i appreciate your help,
Dmitriy.
Coordinator
Apr 1, 2013 at 6:53 AM
Hello,

You can get updated code with fixed issues from source control.

Regards,
Dimtriy.
Apr 24, 2013 at 8:45 PM
Hi!

Nice work on the library. I was trying to register with OAuth provider and I noticed that:
"private MembershipAccount GetUser(string userName)"
has:
"throw new MembershipCreateUserException(MembershipCreateStatus.InvalidUserName);"
if the user is not found with the username. This is used in CreateOrUpdateOAuthAccount to find out if user is already registered and I think it should return null if user is not found for the OAuthAccount creation to work properly.

Regards,
Tuomas
Coordinator
Apr 24, 2013 at 8:52 PM
Thanks Tuomas,

Logic is right there. Why it tthrows exception because when you are trying to create OAuthAccount or usual Account User must be already created.
About method: this method is used in many places and must throw exception in all that places.

Please let me know if you have any more questions.

Regards,
Dimtriy.