Sites using custom membership providers won't authenticate when using Courier
Using Umbraco 7.10.0
I get this error when I try to publish to my staging site from my development machine.
Server was unable to process request. ---> User: courier.admin could not be authenticated
I am using the following packages:
UmbBackofficeMembershipProvider 4.1.1
Courier Express 3.1.6
The license was created today and exists on both machines. The username is in the database for both machines. I've tried the useLegacyEncoding attribute in the web.config with no success. I've also installed Courier at both locations. Nothing stands out in the logs.
I created a solution that allows legacy calls to use Active Directory to not error out. This class is compatible with the ActiveDirectoryBackOfficeUserPasswordChecker class. It allows implementers to use Active Directory in Courier and elsewhere the legacy MembershipProvider is used. The user still needs to be created in the UI or database.
using System;
using System.Configuration;
using System.DirectoryServices.AccountManagement;
using System.Web.Security;
using Umbraco.Web.Security.Providers;
namespace Umbraco.Backoffice.ActiveDirectoryMembership
{
public class UmbracoActiveDirectoryMembershipProvider : UsersMembershipProvider
{
public override bool AllowManuallyChangingPassword => false;
public override bool ValidateUser(string username, string password)
{
bool flag = false;
using (PrincipalContext context = new PrincipalContext(ContextType.Domain, ConfigurationManager.AppSettings["ActiveDirectoryDomain"]))
{
flag = context.ValidateCredentials(username, password);
}
return flag;
}
protected override bool PerformChangePassword(string username, string oldPassword, string newPassword)
{
throw new NotSupportedException("The password must be changed in Active Directory");
}
protected override bool PerformChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
{
throw new NotSupportedException("Password Question/Answer is not supported by AD");
}
protected override MembershipUser PerformCreateUser(string memberTypeAlias, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
{
return base.PerformCreateUser(memberTypeAlias, username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status);
}
protected override string PerformGetPassword(string username, string answer)
{
throw new NotSupportedException("The Active Directory Provider does not support getting the password");
}
protected override string PerformResetPassword(string username, string answer, string generatedPassword)
{
throw new NotSupportedException("The password must be reset in Active Directory");
}
}
}
Sites using custom membership providers won't authenticate when using Courier
Using Umbraco 7.10.0
I get this error when I try to publish to my staging site from my development machine.
I am using the following packages:
UmbBackofficeMembershipProvider 4.1.1
Courier Express 3.1.6
The license was created today and exists on both machines. The username is in the database for both machines. I've tried the useLegacyEncoding attribute in the web.config with no success. I've also installed Courier at both locations. Nothing stands out in the logs.
FWIW: It is working with the same custom auth provider in our 7.9 install without this issue.
I created a solution that allows legacy calls to use Active Directory to not error out. This class is compatible with the ActiveDirectoryBackOfficeUserPasswordChecker class. It allows implementers to use Active Directory in Courier and elsewhere the legacy MembershipProvider is used. The user still needs to be created in the UI or database.
is working on a reply...