Custom Membership Provider

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
JohnK
Ensign (ENS)
Ensign (ENS)
Posts: 8
Joined: Wed Aug 25, 2010 12:34 pm

Custom Membership Provider

Post by JohnK » Thu Dec 16, 2010 2:13 pm

I have posted about this issue before when I was prototyping with AbleCommerce but now I actually need to get the site up.

Anyway, I have AbleCommerce 7.0.5 sp1 and I am attempting to implement a custom membership provider. It seems that no matter what I do, the default AbleCommerce MembershipProvider is used.

The provider is stored in a dll called Lib.Commerce.
It is located at Lib.Commerce.CustomMembership.

It currently looks like this (I will be implementing some of the members when I get this working):

Code: Select all

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Security;

namespace Lib.Commerce
{
    public class CustomMembership : MembershipProvider
    {
        private const string KeyName = "Lib.Commerce";
        public override string ApplicationName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            throw new NotImplementedException();
        }

        public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
        {
            throw new NotImplementedException();
        }

        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            throw new NotImplementedException();
        }

        public override bool DeleteUser(string username, bool deleteAllRelatedData)
        {
            throw new NotImplementedException();
        }

        public override bool EnablePasswordReset
        {
            get { throw new NotImplementedException(); }
        }

        public override bool EnablePasswordRetrieval
        {
            get { throw new NotImplementedException(); }
        }

        public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override int GetNumberOfUsersOnline()
        {
            throw new NotImplementedException();
        }

        public override string GetPassword(string username, string answer)
        {
            throw new NotImplementedException();
        }

        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            throw new NotImplementedException();
        }

        public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
        {
            throw new NotImplementedException();
        }

        public override string GetUserNameByEmail(string email)
        {
            throw new NotImplementedException();
        }

        public override int MaxInvalidPasswordAttempts
        {
            get { throw new NotImplementedException(); }
        }

        public override int MinRequiredNonAlphanumericCharacters
        {
            get { throw new NotImplementedException(); }
        }

        public override int MinRequiredPasswordLength
        {
            get { throw new NotImplementedException(); }
        }

        public override int PasswordAttemptWindow
        {
            get { throw new NotImplementedException(); }
        }

        public override MembershipPasswordFormat PasswordFormat
        {
            get { throw new NotImplementedException(); }
        }

        public override string PasswordStrengthRegularExpression
        {
            get { throw new NotImplementedException(); }
        }

        public override bool RequiresQuestionAndAnswer
        {
            get { throw new NotImplementedException(); }
        }

        public override bool RequiresUniqueEmail
        {
            get { throw new NotImplementedException(); }
        }

        public override string ResetPassword(string username, string answer)
        {
            throw new NotImplementedException();
        }

        public override bool UnlockUser(string userName)
        {
            throw new NotImplementedException();
        }

        public override void UpdateUser(MembershipUser user)
        {
            throw new NotImplementedException();
        }

        public override bool ValidateUser(string username, string password)
        {
            var ai = Repository.Core.AuthenticateUser(un, password);
            return ai!=null && ai.Authenticated;
        }
    }
}

My configuration looks like this:

Code: Select all

<membership defaultProvider="CustomMembership">
			<providers>
				<clear />
				<add name="CustomMembership" applicationName="/" type="Lib.Commerce.CustomMembership" />
			</providers>
		</membership>
I have added the dll to the root bin folder of my site. Is there anything else I need to do to get this working? I am getting very frustrated because it seems like a pretty straight forward process. I have also read through the '4-guys-from-rolla' post on this issue so I don't need that link again...

** Update **
I just created a test website and threw the Lib.Commerce dll in the bin folder. It picked up the dll and my custom MembershipProvider worked flawlessly. Anyone from the AbleCommerce team have an idea what the issue is here?

Thanks,
John
Last edited by JohnK on Mon Dec 20, 2010 12:33 pm, edited 1 time in total.

User avatar
igavemybest
Captain (CAPT)
Captain (CAPT)
Posts: 388
Joined: Sun Apr 06, 2008 5:47 pm

Re: Custom Membership Provider

Post by igavemybest » Fri Dec 17, 2010 8:12 pm

I am pretty sure it has to do with the commercebuilder.dll, we had to purchase the source code to do implementations of various different things, but I would suggest opening a support ticket, and ask if you need to purchase and modify the source to use a custom membership provider.Wish I could help more, just dont have time to look through all the code at the moment.

JohnK
Ensign (ENS)
Ensign (ENS)
Posts: 8
Joined: Wed Aug 25, 2010 12:34 pm

Re: Custom Membership Provider

Post by JohnK » Mon Dec 20, 2010 10:52 am

Thanks...

Yeah, we bought the source so I could look into that but I was under the impression that since AbleCommerce was using a MembershipProvider themselves, that we would simply have to set this up in the config to use our own. I don't really feel like looking through all the source but I guess I can start there. I will open a support ticket as well and see where that gets me.

John

User avatar
igavemybest
Captain (CAPT)
Captain (CAPT)
Posts: 388
Joined: Sun Apr 06, 2008 5:47 pm

Re: Custom Membership Provider

Post by igavemybest » Tue Dec 21, 2010 12:41 pm

Let me know what you find, sorry I couldnt be of more assistance!

Post Reply