本文整理汇总了C#中System.Web.Security.MembershipProvider类的典型用法代码示例。如果您正苦于以下问题:C# MembershipProvider类的具体用法?C# MembershipProvider怎么用?C# MembershipProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MembershipProvider类属于System.Web.Security命名空间,在下文中一共展示了MembershipProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultProviderSwitcher
public DefaultProviderSwitcher(
MembershipProviderAccessor membershipProviderAccessor,
RoleProviderAccessor roleProviderAccessor,
MembershipProvider provider,
RoleProvider roleProvider)
{
Condition.Requires(membershipProviderAccessor, "membershipProviderAccessor").IsNotNull();
Condition.Requires(roleProviderAccessor, "roleProviderAccessor").IsNotNull();
Condition.Requires(provider, "provider").IsNotNull();
Condition.Requires(roleProvider, "roleProvider").IsNotNull();
this.membershipProviderAccessor = membershipProviderAccessor;
this.roleProviderAccessor = roleProviderAccessor;
this.originalMembershipInitializedDefault =
membershipProviderAccessor.SetInitializedDefaultProviderAndReturnOriginalValue(true);
this.originalMembershipInitialized = membershipProviderAccessor.SetInitializedAndReturnOriginalValue(true);
this.originalMembershipProvider = membershipProviderAccessor.SetProviderAndReturnOriginalValue(provider);
this.originalRoleEnabledInitialized = roleProviderAccessor.SetEnabledAndReturnOriginalValue(true);
this.originalRoleProviders =
roleProviderAccessor.SetProvidersAndReturnOriginalValue(new RoleProviderCollection());
this.originalRoleInitializedDefault =
roleProviderAccessor.SetInitializedDefaultProviderAndReturnOriginalValue(true);
this.originalRoleInitialized = roleProviderAccessor.SetInitializedAndReturnOriginalValue(true);
this.originalRoleProvider = roleProviderAccessor.SetProviderAndReturnOriginalValue(roleProvider);
}
示例2: MembershipService
public MembershipService()
{
if (Membership.Provider is MonsterMembershipProvider)
Provider = Membership.Provider;
else
throw new InvalidOperationException("Membership provider not supported");
}
示例3: InitializeMembershipProviderFromConfigEntry
public void InitializeMembershipProviderFromConfigEntry(MembershipProvider result,
IEnumerable<KeyValuePair<string, string>> simulatedAppConfigSettings)
{
NameValueCollection nameValueCollection = null;
MembershipSection membership = ConfigurationManager.GetSection("system.web/membership") as MembershipSection;
foreach (ProviderSettings settings in membership.Providers)
{
if (settings.Name == FixtureConstants.NameOfConfiguredMembershipProvider)
{
nameValueCollection = new NameValueCollection(settings.Parameters);
break;
}
}
if (nameValueCollection == null)
{
throw new Exception("Configuration not found for membership provider RavenDBMembership.");
}
nameValueCollection["connectionStringName"] = "StubConnectionString";
foreach (var kvp in simulatedAppConfigSettings)
{
ValidateConfigurationValue(kvp.Key, kvp.Value);
nameValueCollection.Set(kvp.Key, kvp.Value);
}
result.Initialize(FixtureConstants.NameOfConfiguredMembershipProvider, nameValueCollection);
}
示例4: AuthenticationService
public AuthenticationService(MembershipProvider membershipProvider)
{
_membershipProvider = membershipProvider
?? Membership.Provider;
MinPasswordLength = _membershipProvider.MinRequiredPasswordLength;
}
示例5: AccountMembershipService
public AccountMembershipService(MembershipProvider provider)
{
if (provider == null)
throw new ArgumentNullException("provider");
_provider = provider;
}
示例6: CreateDefaultSimpleMembershipProvider
private static SimpleMembershipProvider CreateDefaultSimpleMembershipProvider(string name, MembershipProvider currentDefault)
{
MembershipProvider previousProvider = currentDefault;
SimpleMembershipProvider provider = new SimpleMembershipProvider(previousProvider);
NameValueCollection config = new NameValueCollection();
provider.Initialize(name, config);
return provider;
}
示例7: SQLiteFacebookMembershipProvider
public SQLiteFacebookMembershipProvider(string connectionString, string tableName, MembershipProvider membershipProvider)
{
_connectionString = connectionString;
_tableName = tableName ?? "facebook_users";
_membershipProvider = membershipProvider;
// we cound had done _membershipProvider = membershipProvider ?? Membership.Provider
// but that wouldn't allow to work under client profile
}
示例8: WebValidateUserPolicy
public WebValidateUserPolicy(MembershipProvider provider)
: base((IMemberShipProvider)provider)
{
this.MaxInvalidPasswordAttempts = provider.MaxInvalidPasswordAttempts;
this.PasswordAttemptWindow = provider.PasswordAttemptWindow;
this.PasswordStrengthRegularExpression = provider.PasswordStrengthRegularExpression;
this.MinRequiredPasswordLength = provider.MinRequiredPasswordLength;
}
示例9: CreateMembershipProviderValidator
public static UserNamePasswordValidator CreateMembershipProviderValidator(MembershipProvider provider)
{
if (provider == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("provider");
}
return new MembershipProviderValidator(provider);
}
示例10: MySqlSimpleMembershipProvider
public MySqlSimpleMembershipProvider(MembershipProvider previousProvider)
{
_prevProvider = previousProvider;
if (_prevProvider != null)
{
_prevProvider.ValidatingPassword += delegate(object sender, ValidatePasswordEventArgs args) { this.OnValidatingPassword(args); };
}
}
示例11: ClientFormsIdentity
public ClientFormsIdentity (string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies)
{
Password = password;
Name = name;
Provider = provider;
AuthenticationType = authenticationType;
IsAuthenticated = isAuthenticated;
AuthenticationCookies = authenticationCookies;
}
示例12: ClientFormsIdentity
public ClientFormsIdentity(string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies)
{
_Name = name;
_AuthenticationType = authenticationType;
_IsAuthenticated = isAuthenticated;
_AuthenticationCookies = authenticationCookies;
_Password = GetSecureStringFromString(password);
_Provider = provider;
}
示例13: FakeMembershipProviderTest
public FakeMembershipProviderTest()
{
this.localProvider = Substitute.For<MembershipProvider>();
this.provider = new FakeMembershipProvider();
this.provider.LocalProvider.Value = this.localProvider;
this.user = new MembershipUser("fake", UserName, new Guid(), null, null, null, true, false, DateTime.MinValue,
DateTime.Now, DateTime.Now, DateTime.MinValue, DateTime.MinValue);
}
示例14: Create
public static RequestInterceptor Create(string realm, MembershipProvider membershipProvider)
{
var basicAuthenticationCredentialsExtractor = new BasicAuthenticationCredentialsExtractor(new Base64Decoder(), new DecodedCredentialsExtractor());
var httpRequestAuthorizationExtractor = new AuthorizationStringExtractor();
var responseMessageFactory = new ResponseMessageFactory(realm);
var serviceSecurityContextFactory = new ServiceSecurityContextFactory(new AuthorizationPolicyFactory());
var basicAuthenticationManager = new BasicAuthenticationManager(basicAuthenticationCredentialsExtractor, httpRequestAuthorizationExtractor, membershipProvider, responseMessageFactory, serviceSecurityContextFactory);
return new BasicAuthenticationInterceptor(basicAuthenticationManager);
}
示例15: PostInitializeUpdate
public override void PostInitializeUpdate(MembershipProvider provider)
{
var connectionStringProperty = typeof(SqlMembershipProvider).GetField("_sqlConnectionString",
BindingFlags.NonPublic |
BindingFlags.Instance);
Assert.That(connectionStringProperty, Is.Not.Null);
connectionStringProperty.SetValue(provider, DatabaseInitialization.GetConnectionStringFor(FixtureConstants.DatabaseName));
}