adds new interface for members' membership providers to implement so we know what aliases to store data against.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Umbraco.Core.Security
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface for exposing the content type properties for storing membership data in when
|
||||
/// a membership provider's data is backed by an Umbraco content type.
|
||||
/// </summary>
|
||||
public interface IUmbracoContentTypeMembershipProvider
|
||||
{
|
||||
|
||||
string LockPropertyTypeAlias { get; }
|
||||
string LastLockedOutPropertyTypeAlias { get; }
|
||||
string FailedPasswordAttemptsPropertyTypeAlias { get; }
|
||||
string ApprovedPropertyTypeAlias { get; }
|
||||
string CommentPropertyTypeAlias { get; }
|
||||
string LastLoginPropertyTypeAlias { get; }
|
||||
string LastPasswordChangedPropertyTypeAlias { get; }
|
||||
string PasswordRetrievalQuestionPropertyTypeAlias { get; }
|
||||
string PasswordRetrievalAnswerPropertyTypeAlias { get; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -751,6 +751,7 @@
|
||||
<Compile Include="Security\MembershipProviderExtensions.cs" />
|
||||
<Compile Include="Security\UmbracoBackOfficeIdentity.cs" />
|
||||
<Compile Include="Security\UmbracoMembershipProviderBase.cs" />
|
||||
<Compile Include="Security\UmbracoMembersMembershipProviderBase.cs" />
|
||||
<Compile Include="Security\UserData.cs" />
|
||||
<Compile Include="Serialization\AbstractSerializationService.cs" />
|
||||
<Compile Include="Serialization\Formatter.cs" />
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Web.Security;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
@@ -17,7 +18,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
/// <summary>
|
||||
/// Custom Membership Provider for Umbraco Members (User authentication for Frontend applications NOT umbraco CMS)
|
||||
/// </summary>
|
||||
public class MembersMembershipProvider : UmbracoServiceMembershipProvider<IMembershipMemberService, IMember>
|
||||
public class MembersMembershipProvider : UmbracoServiceMembershipProvider<IMembershipMemberService, IMember>, IUmbracoContentTypeMembershipProvider
|
||||
{
|
||||
public MembersMembershipProvider()
|
||||
: this(ApplicationContext.Current.Services.MemberService)
|
||||
@@ -49,6 +50,16 @@ namespace Umbraco.Web.Security.Providers
|
||||
return entity.AsConcreteMembershipUser(Name);
|
||||
}
|
||||
|
||||
public string LockPropertyTypeAlias { get; protected set; }
|
||||
public string LastLockedOutPropertyTypeAlias { get; protected set; }
|
||||
public string FailedPasswordAttemptsPropertyTypeAlias { get; protected set; }
|
||||
public string ApprovedPropertyTypeAlias { get; protected set; }
|
||||
public string CommentPropertyTypeAlias { get; protected set; }
|
||||
public string LastLoginPropertyTypeAlias { get; protected set; }
|
||||
public string LastPasswordChangedPropertyTypeAlias { get; protected set; }
|
||||
public string PasswordRetrievalQuestionPropertyTypeAlias { get; protected set; }
|
||||
public string PasswordRetrievalAnswerPropertyTypeAlias { get; protected set; }
|
||||
|
||||
public override void Initialize(string name, NameValueCollection config)
|
||||
{
|
||||
base.Initialize(name, config);
|
||||
@@ -65,7 +76,49 @@ namespace Umbraco.Web.Security.Providers
|
||||
{
|
||||
throw new ProviderException("No default MemberType alias is specified in the web.config string. Please add a 'defaultMemberTypeAlias' to the add element in the provider declaration in web.config");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// test for approve status
|
||||
if (config["umbracoApprovePropertyTypeAlias"] != null)
|
||||
{
|
||||
ApprovedPropertyTypeAlias = config["umbracoApprovePropertyTypeAlias"];
|
||||
}
|
||||
// test for lock attempts
|
||||
if (config["umbracoLockPropertyTypeAlias"] != null)
|
||||
{
|
||||
LockPropertyTypeAlias = config["umbracoLockPropertyTypeAlias"];
|
||||
}
|
||||
if (config["umbracoLastLockedPropertyTypeAlias"] != null)
|
||||
{
|
||||
LastLockedOutPropertyTypeAlias = config["umbracoLastLockedPropertyTypeAlias"];
|
||||
}
|
||||
if (config["umbracoLastPasswordChangedPropertyTypeAlias"] != null)
|
||||
{
|
||||
LastPasswordChangedPropertyTypeAlias = config["umbracoLastPasswordChangedPropertyTypeAlias"];
|
||||
}
|
||||
if (config["umbracoFailedPasswordAttemptsPropertyTypeAlias"] != null)
|
||||
{
|
||||
FailedPasswordAttemptsPropertyTypeAlias = config["umbracoFailedPasswordAttemptsPropertyTypeAlias"];
|
||||
}
|
||||
// comment property
|
||||
if (config["umbracoCommentPropertyTypeAlias"] != null)
|
||||
{
|
||||
CommentPropertyTypeAlias = config["umbracoCommentPropertyTypeAlias"];
|
||||
}
|
||||
// last login date
|
||||
if (config["umbracoLastLoginPropertyTypeAlias"] != null)
|
||||
{
|
||||
LastLoginPropertyTypeAlias = config["umbracoLastLoginPropertyTypeAlias"];
|
||||
}
|
||||
// password retrieval
|
||||
if (config["umbracoPasswordRetrievalQuestionPropertyTypeAlias"] != null)
|
||||
{
|
||||
PasswordRetrievalQuestionPropertyTypeAlias = config["umbracoPasswordRetrievalQuestionPropertyTypeAlias"];
|
||||
}
|
||||
if (config["umbracoPasswordRetrievalAnswerPropertyTypeAlias"] != null)
|
||||
{
|
||||
PasswordRetrievalAnswerPropertyTypeAlias = config["umbracoPasswordRetrievalAnswerPropertyTypeAlias"];
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultMemberTypeAlias
|
||||
|
||||
@@ -14,6 +14,8 @@ using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.Security.Providers
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Abstract Membership Provider that users any implementation of IMembershipMemberService{TEntity} service
|
||||
/// </summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace umbraco.providers.members
|
||||
/// Custom Membership Provider for Umbraco Members (User authentication for Frontend applications NOT umbraco CMS)
|
||||
/// </summary>
|
||||
[Obsolete("This has been superceded by Umbraco.Web.Security.Providers.MembersMembershipProvider")]
|
||||
public class UmbracoMembershipProvider : UmbracoMembershipProviderBase
|
||||
public class UmbracoMembershipProvider : UmbracoMembershipProviderBase, IUmbracoContentTypeMembershipProvider
|
||||
{
|
||||
public UmbracoMembershipProvider()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user