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

@ -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; }
}
}
}