Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -62,6 +62,4 @@ using System.Runtime.Versioning;
[assembly: InternalsVisibleTo ("System.Web, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: AllowPartiallyTrustedCallers]
#if NET_4_0
[assembly: SecurityRules (SecurityRuleSet.Level2, SkipVerificationInFullTrust=true)]
#endif

View File

@@ -0,0 +1,51 @@
//
// System.Web.Security.MembershipCreateStatus
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public enum MembershipCreateStatus
{
Success,
InvalidUserName,
InvalidPassword,
InvalidQuestion,
InvalidAnswer,
InvalidEmail,
DuplicateUserName,
DuplicateEmail,
UserRejected,
InvalidProviderUserKey,
DuplicateProviderUserKey,
ProviderError
}
}

View File

@@ -0,0 +1,77 @@
//
// System.Web.Security.MembershipCreateUserException
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Serializable]
public class MembershipCreateUserException : Exception
{
MembershipCreateStatus statusCode;
public MembershipCreateUserException ()
{
}
public MembershipCreateUserException (string message): base (message)
{
}
public MembershipCreateUserException (string message, Exception innerException): base (message, innerException)
{
}
protected MembershipCreateUserException (SerializationInfo info, StreamingContext context): base (info, context)
{
info.AddValue ("statusCode", statusCode);
}
public MembershipCreateUserException (MembershipCreateStatus statusCode) : base (statusCode.ToString ())
{
this.statusCode = statusCode;
}
public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
{
base.GetObjectData (info, ctx);
statusCode = (MembershipCreateStatus) info.GetValue ("statusCode", typeof(MembershipCreateStatus));
}
public MembershipCreateStatus StatusCode {
get { return statusCode; }
}
}
}

View File

@@ -0,0 +1,51 @@
//
// System.Web.Security.MembershipPasswordException
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Serializable]
public class MembershipPasswordException : Exception
{
public MembershipPasswordException () : base () {}
public MembershipPasswordException (string message) : base (message) {}
public MembershipPasswordException (string message, Exception innerException) : base (message, innerException) {}
protected MembershipPasswordException (SerializationInfo info, StreamingContext context): base (info, context)
{
}
}
}

View File

@@ -0,0 +1,43 @@
//
// System.Web.Security.MembershipPasswordFormat
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public enum MembershipPasswordFormat
{
Clear = 0,
Hashed = 1,
Encrypted = 2
}
}

View File

@@ -0,0 +1,137 @@
//
// System.Web.Security.MembershipProvider
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2003 Ben Maurer
// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Configuration.Provider;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Web.Configuration;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public abstract class MembershipProvider : ProviderBase
{
const string HELPER_TYPE_NAME = "System.Web.Security.MembershipHelper, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
internal static IMembershipHelper Helper {
get { return helper; }
}
static IMembershipHelper helper;
static readonly object validatingPasswordEvent = new object ();
EventHandlerList events = new EventHandlerList ();
public event MembershipValidatePasswordEventHandler ValidatingPassword {
add { events.AddHandler (validatingPasswordEvent, value); }
remove { events.RemoveHandler (validatingPasswordEvent, value); }
}
static MembershipProvider ()
{
Type type = Type.GetType (HELPER_TYPE_NAME, false);
if (type == null)
return;
try {
helper = Activator.CreateInstance (type) as IMembershipHelper;
} catch {
// ignore
}
}
protected MembershipProvider ()
{
}
public abstract bool ChangePassword (string name, string oldPwd, string newPwd);
public abstract bool ChangePasswordQuestionAndAnswer (string name, string password, string newPwdQuestion, string newPwdAnswer);
public abstract MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status);
public abstract bool DeleteUser (string name, bool deleteAllRelatedData);
public abstract MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords);
public abstract MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords);
public abstract MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords);
public abstract int GetNumberOfUsersOnline ();
public abstract string GetPassword (string name, string answer);
public abstract MembershipUser GetUser (string name, bool userIsOnline);
public abstract MembershipUser GetUser (object providerUserKey, bool userIsOnline);
public abstract string GetUserNameByEmail (string email);
public abstract string ResetPassword (string name, string answer);
public abstract void UpdateUser (MembershipUser user);
public abstract bool ValidateUser (string name, string password);
public abstract bool UnlockUser (string userName);
public abstract string ApplicationName { get; set; }
public abstract bool EnablePasswordReset { get; }
public abstract bool EnablePasswordRetrieval { get; }
public abstract bool RequiresQuestionAndAnswer { get; }
public abstract int MaxInvalidPasswordAttempts { get; }
public abstract int MinRequiredNonAlphanumericCharacters { get; }
public abstract int MinRequiredPasswordLength { get; }
public abstract int PasswordAttemptWindow { get; }
public abstract MembershipPasswordFormat PasswordFormat { get; }
public abstract string PasswordStrengthRegularExpression { get; }
public abstract bool RequiresUniqueEmail { get; }
protected virtual void OnValidatingPassword (ValidatePasswordEventArgs args)
{
MembershipValidatePasswordEventHandler eh = events [validatingPasswordEvent] as MembershipValidatePasswordEventHandler;
if (eh != null)
eh (this, args);
}
protected virtual byte [] DecryptPassword (byte [] encodedPassword)
{
if (helper == null)
throw new PlatformNotSupportedException ("This method is not available.");
return helper.DecryptPassword (encodedPassword);
}
protected virtual byte[] EncryptPassword (byte[] password)
{
return EncryptPassword (password, MembershipPasswordCompatibilityMode.Framework20);
}
[MonoTODO ("Discover what actually is 4.0 password compatibility mode.")]
protected virtual byte[] EncryptPassword (byte[] password, MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode)
{
if (helper == null)
throw new PlatformNotSupportedException ("This method is not available.");
if (legacyPasswordCompatibilityMode == MembershipPasswordCompatibilityMode.Framework40)
throw new PlatformNotSupportedException ("Framework 4.0 password encryption mode is not supported at this time.");
return helper.EncryptPassword (password);
}
}
}

View File

@@ -0,0 +1,62 @@
//
// System.Web.Security.MembershipProviderCollection
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Ben Maurer
// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Configuration.Provider;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public sealed class MembershipProviderCollection : ProviderCollection
{
public override void Add (ProviderBase provider)
{
if (provider == null)
throw new ArgumentNullException ("provider");
if (provider is MembershipProvider)
base.Add (provider);
else {
throw new ArgumentException ("provider", Locale.GetText (
"Wrong type, expected {0}.", "MembershipProvider"));
}
}
public void CopyTo (MembershipProvider[] array, int index)
{
base.CopyTo (array, index);
}
public new MembershipProvider this [string name] {
get { return (MembershipProvider) base [name]; }
}
}
}

View File

@@ -0,0 +1,239 @@
//
// System.Web.Security.MembershipUser
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Serializable]
public class MembershipUser
{
string providerName;
string name;
object providerUserKey;
string email;
string passwordQuestion;
string comment;
bool isApproved;
bool isLockedOut;
DateTime creationDate;
DateTime lastLoginDate;
DateTime lastActivityDate;
DateTime lastPasswordChangedDate;
DateTime lastLockoutDate;
protected MembershipUser ()
{
}
public MembershipUser (string providerName, string name, object providerUserKey, string email,
string passwordQuestion, string comment, bool isApproved, bool isLockedOut,
DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate,
DateTime lastPasswordChangedDate, DateTime lastLockoutDate)
{
this.providerName = providerName;
this.name = name;
this.providerUserKey = providerUserKey;
this.email = email;
this.passwordQuestion = passwordQuestion;
this.comment = comment;
this.isApproved = isApproved;
this.isLockedOut = isLockedOut;
this.creationDate = creationDate.ToUniversalTime ();
this.lastLoginDate = lastLoginDate.ToUniversalTime ();
this.lastActivityDate = lastActivityDate.ToUniversalTime ();
this.lastPasswordChangedDate = lastPasswordChangedDate.ToUniversalTime ();
this.lastLockoutDate = lastLockoutDate.ToUniversalTime ();
}
void UpdateSelf (MembershipUser fromUser)
{
try { Comment = fromUser.Comment; } catch (NotSupportedException) {}
try { creationDate = fromUser.CreationDate; } catch (NotSupportedException) {}
try { Email = fromUser.Email; } catch (NotSupportedException) {}
try { IsApproved = fromUser.IsApproved; } catch (NotSupportedException) {}
try { isLockedOut = fromUser.IsLockedOut; } catch (NotSupportedException) {}
try { LastActivityDate = fromUser.LastActivityDate; } catch (NotSupportedException) {}
try { lastLockoutDate = fromUser.LastLockoutDate; } catch (NotSupportedException) {}
try { LastLoginDate = fromUser.LastLoginDate; } catch (NotSupportedException) {}
try { lastPasswordChangedDate = fromUser.LastPasswordChangedDate; } catch (NotSupportedException) {}
try { passwordQuestion = fromUser.PasswordQuestion; } catch (NotSupportedException) {}
try { providerUserKey = fromUser.ProviderUserKey; } catch (NotSupportedException) {}
}
internal void UpdateUser ()
{
MembershipUser newUser = Provider.GetUser (UserName, false);
UpdateSelf (newUser);
}
public virtual bool ChangePassword (string oldPassword, string newPassword)
{
bool success = Provider.ChangePassword (UserName, oldPassword, newPassword);
UpdateUser ();
return success;
}
public virtual bool ChangePasswordQuestionAndAnswer (string password, string newPasswordQuestion, string newPasswordAnswer)
{
bool success = Provider.ChangePasswordQuestionAndAnswer (UserName, password, newPasswordQuestion, newPasswordAnswer);
UpdateUser ();
return success;
}
public virtual string GetPassword ()
{
return GetPassword (null);
}
public virtual string GetPassword (string answer)
{
return Provider.GetPassword (UserName, answer);
}
public virtual string ResetPassword ()
{
return ResetPassword (null);
}
public virtual string ResetPassword (string answer)
{
string newPass = Provider.ResetPassword (UserName, answer);
UpdateUser ();
return newPass;
}
public virtual string Comment {
get { return comment; }
set { comment = value; }
}
public virtual DateTime CreationDate {
get { return creationDate.ToLocalTime (); }
}
public virtual string Email {
get { return email; }
set { email = value; }
}
public virtual bool IsApproved {
get { return isApproved; }
set { isApproved = value; }
}
public virtual bool IsLockedOut {
get { return isLockedOut; }
}
public virtual
bool IsOnline {
get {
int minutes;
IMembershipHelper helper = MembershipProvider.Helper;
if (helper == null)
throw new PlatformNotSupportedException ("The method is not available.");
minutes = helper.UserIsOnlineTimeWindow;
return LastActivityDate > DateTime.Now - TimeSpan.FromMinutes (minutes);
}
}
public virtual DateTime LastActivityDate {
get { return lastActivityDate.ToLocalTime (); }
set { lastActivityDate = value.ToUniversalTime (); }
}
public virtual DateTime LastLoginDate {
get { return lastLoginDate.ToLocalTime (); }
set { lastLoginDate = value.ToUniversalTime (); }
}
public virtual DateTime LastPasswordChangedDate {
get { return lastPasswordChangedDate.ToLocalTime (); }
}
public virtual DateTime LastLockoutDate {
get { return lastLockoutDate.ToLocalTime (); }
}
public virtual string PasswordQuestion {
get { return passwordQuestion; }
}
public virtual string ProviderName {
get { return providerName; }
}
public virtual string UserName {
get { return name; }
}
public virtual object ProviderUserKey {
get { return providerUserKey; }
}
public override string ToString ()
{
return UserName;
}
public virtual bool UnlockUser ()
{
bool retval = Provider.UnlockUser (UserName);
UpdateUser ();
return retval;
}
MembershipProvider Provider {
get {
MembershipProvider p;
IMembershipHelper helper = MembershipProvider.Helper;
if (helper == null)
throw new PlatformNotSupportedException ("The method is not available.");
p = helper.Providers [ProviderName];
if (p == null)
throw new InvalidOperationException ("Membership provider '" + ProviderName + "' not found.");
return p;
}
}
}
}

View File

@@ -0,0 +1,112 @@
//
// System.Web.Security.MembershipUserCollection
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Runtime.CompilerServices;
using System.Web.UI;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Serializable]
public sealed class MembershipUserCollection : ICollection
{
public MembershipUserCollection ()
{
}
public void Add (MembershipUser user)
{
if (user == null)
throw new ArgumentNullException ("user");
CheckNotReadOnly ();
store.Add (user.UserName, user);
}
public void Clear ()
{
CheckNotReadOnly ();
store.Clear ();
}
void ICollection.CopyTo (Array array, int index)
{
store.Values.CopyTo (array, index);
}
public void CopyTo (MembershipUser[] array, int index)
{
store.Values.CopyTo (array, index);
}
public IEnumerator GetEnumerator ()
{
return ((IEnumerable) store).GetEnumerator ();
}
public void Remove (string name)
{
CheckNotReadOnly ();
store.Remove (name);
}
public void SetReadOnly ()
{
readOnly = true;
}
public int Count {
get { return store.Count; }
}
public bool IsSynchronized {
get { return false; }
}
public MembershipUser this [string name] {
get { return (MembershipUser) store [name]; }
}
public object SyncRoot {
get { return this; }
}
void CheckNotReadOnly ()
{
if (readOnly)
throw new NotSupportedException ();
}
KeyedList store = new KeyedList ();
bool readOnly = false;
}
}

View File

@@ -0,0 +1,39 @@
//
// System.Web.Security.MembershipValidatePasswordEventHandler
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2005 Novell, inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public delegate void MembershipValidatePasswordEventHandler (object sender, ValidatePasswordEventArgs e);
}

View File

@@ -0,0 +1,56 @@
//
// System.Web.Security.IRoleProvider
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Configuration.Provider;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public abstract class RoleProvider : ProviderBase
{
protected RoleProvider ()
{
}
public abstract void AddUsersToRoles (string [] usernames, string [] rolenames);
public abstract void CreateRole (string rolename);
public abstract bool DeleteRole (string rolename, bool throwOnPopulatedRole);
public abstract string [] FindUsersInRole (string roleName, string usernameToMatch);
public abstract string [] GetAllRoles ();
public abstract string [] GetRolesForUser (string username);
public abstract string [] GetUsersInRole (string rolename);
public abstract bool IsUserInRole (string username, string rolename);
public abstract void RemoveUsersFromRoles (string [] usernames, string [] rolenames);
public abstract bool RoleExists (string rolename);
public abstract string ApplicationName { get; set; }
}
}

View File

@@ -0,0 +1,74 @@
//
// System.Web.Security.ValidatePasswordEventArgs
//
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2005 Novell, inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.CompilerServices;
namespace System.Web.Security
{
[TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public sealed class ValidatePasswordEventArgs: EventArgs
{
bool cancel;
Exception exception;
bool isNewUser;
string userName;
string password;
public ValidatePasswordEventArgs (string userName, string password, bool isNewUser)
{
this.isNewUser = isNewUser;
this.userName = userName;
this.password = password;
}
public bool Cancel {
get { return cancel; }
set { cancel = value; }
}
public Exception FailureInformation {
get { return exception; }
set { exception = value; }
}
public bool IsNewUser {
get { return isNewUser; }
}
public string UserName {
get { return userName; }
}
public string Password {
get { return password; }
}
}
}

View File

@@ -0,0 +1,181 @@
//
// System.Web.UI/KeyedList.cs
//
// Author: Todd Berman <tberman@gentoo.org>
//
// (C) 2003 Todd Berman
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Specialized;
namespace System.Web.UI
{
class KeyedList : IOrderedDictionary
{
Hashtable objectTable = new Hashtable ();
ArrayList objectList = new ArrayList ();
public void Add (object key, object value)
{
objectTable.Add (key, value);
objectList.Add (new DictionaryEntry (key, value));
}
public void Clear ()
{
objectTable.Clear ();
objectList.Clear ();
}
public bool Contains (object key)
{
return objectTable.Contains (key);
}
public void CopyTo (Array array, int idx)
{
objectTable.CopyTo (array, idx);
}
public void Insert (int idx, object key, object value)
{
if (idx > Count)
throw new ArgumentOutOfRangeException ("index");
objectTable.Add (key, value);
objectList.Insert (idx, new DictionaryEntry (key, value));
}
public void Remove (object key)
{
objectTable.Remove (key);
int index = IndexOf (key);
if (index >= 0)
objectList.RemoveAt (index);
}
public void RemoveAt (int idx)
{
if (idx >= Count)
throw new ArgumentOutOfRangeException ("index");
objectTable.Remove ( ((DictionaryEntry)objectList[idx]).Key );
objectList.RemoveAt (idx);
}
IDictionaryEnumerator IDictionary.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
IDictionaryEnumerator IOrderedDictionary.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return new KeyedListEnumerator (objectList);
}
public int Count {
get { return objectList.Count; }
}
public bool IsFixedSize {
get { return false; }
}
public bool IsReadOnly {
get { return false; }
}
public bool IsSynchronized {
get { return false; }
}
public object this[int idx] {
get { return ((DictionaryEntry) objectList[idx]).Value; }
set {
if (idx < 0 || idx >= Count)
throw new ArgumentOutOfRangeException ("index");
object key = ((DictionaryEntry) objectList[idx]).Key;
objectList[idx] = new DictionaryEntry (key, value);
objectTable[key] = value;
}
}
public object this[object key] {
get { return objectTable[key]; }
set {
if (objectTable.Contains (key))
{
objectTable[key] = value;
objectTable[IndexOf (key)] = new DictionaryEntry (key, value);
return;
}
Add (key, value);
}
}
public ICollection Keys {
get {
ArrayList retList = new ArrayList ();
for (int i = 0; i < objectList.Count; i++)
{
retList.Add ( ((DictionaryEntry)objectList[i]).Key );
}
return retList;
}
}
public ICollection Values {
get {
ArrayList retList = new ArrayList ();
for (int i = 0; i < objectList.Count; i++)
{
retList.Add ( ((DictionaryEntry)objectList[i]).Value );
}
return retList;
}
}
public object SyncRoot {
get { return this; }
}
int IndexOf (object key)
{
for (int i = 0; i < objectList.Count; i++)
{
if (((DictionaryEntry) objectList[i]).Key.Equals (key))
{
return i;
}
}
return -1;
}
}
}

View File

@@ -0,0 +1,84 @@
//
// System.Web.UI/KeyedListEnumerator.cs
//
// Author: Todd Berman <tberman@gentoo.org>
//
// (C) 2003 Todd Berman
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
namespace System.Web.UI
{
internal class KeyedListEnumerator : IDictionaryEnumerator
{
int index = -1;
ArrayList objs;
internal KeyedListEnumerator (ArrayList list)
{
objs = list;
}
public bool MoveNext ()
{
index++;
if (index >= objs.Count)
return false;
return true;
}
public void Reset ()
{
index = -1;
}
public object Current {
get {
if (index < 0 || index >= objs.Count)
throw new InvalidOperationException ();
return ((DictionaryEntry)objs[index]).Value;
}
}
public DictionaryEntry Entry {
get {
return (DictionaryEntry) Current;
}
}
public object Key {
get {
return Entry.Key;
}
}
public object Value {
get {
return Entry.Value;
}
}
}
}

View File

@@ -8,16 +8,16 @@ Assembly/AssemblyInfo.cs
System.Web.Configuration/MembershipPasswordCompatibilityMode.cs
System.Web.Security/IMembershipHelper.cs
../System.Web/System.Web.UI/KeyedList.cs
../System.Web/System.Web.UI/KeyedListEnumerator.cs
../System.Web/System.Web.Security/MembershipCreateStatus.cs
../System.Web/System.Web.Security/MembershipCreateUserException.cs
../System.Web/System.Web.Security/MembershipPasswordException.cs
../System.Web/System.Web.Security/MembershipPasswordFormat.cs
../System.Web/System.Web.Security/MembershipProviderCollection.cs
../System.Web/System.Web.Security/MembershipProvider.cs
../System.Web/System.Web.Security/MembershipUserCollection.cs
../System.Web/System.Web.Security/MembershipUser.cs
../System.Web/System.Web.Security/MembershipValidatePasswordEventHandler.cs
../System.Web/System.Web.Security/RoleProvider.cs
../System.Web/System.Web.Security/ValidatePasswordEventArgs.cs
System.Web.UI/KeyedList.cs
System.Web.UI/KeyedListEnumerator.cs
System.Web.Security/MembershipCreateStatus.cs
System.Web.Security/MembershipCreateUserException.cs
System.Web.Security/MembershipPasswordException.cs
System.Web.Security/MembershipPasswordFormat.cs
System.Web.Security/MembershipProviderCollection.cs
System.Web.Security/MembershipProvider.cs
System.Web.Security/MembershipUserCollection.cs
System.Web.Security/MembershipUser.cs
System.Web.Security/MembershipValidatePasswordEventHandler.cs
System.Web.Security/RoleProvider.cs
System.Web.Security/ValidatePasswordEventArgs.cs