C# Class Microsoft.WindowsAzure.Samples.Storage.Providers.TableStorageMembershipProvider

Inheritance: System.Web.Security.MembershipProvider
显示文件 Open project: WindowsAzure-Toolkits/wa-toolkit-wp-nugets

Public Methods

Method Description
ChangePassword ( string username, string oldPassword, string newPassword ) : bool

Changes a users password. We don't use retries in this highly security-related function. All errors are exposed to the user of this function.

ChangePasswordQuestionAndAnswer ( string username, string password, string newPasswordQuestion, string newPasswordAnswer ) : bool

Change the password answer for a user.

CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus &status ) : System.Web.Security.MembershipUser

Creates a new user and stores it in the membership table. We do not use retry policies in this highly security-related function. All error conditions are directly exposed to the user.

DeleteUser ( string username, bool deleteAllRelatedData ) : bool

Deletes the user from the membership table. This implementation ignores the deleteAllRelatedData argument

FindUsersByName ( string usernameToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection

Find users by their names. The usernameToMatch must be the complete username like frank or can contain a '%' character at the end. A '%' character at the end implies that arbitrary characters can follow. Supporting additional searches right now would be very expensive because the filtering would have to be done on the client side; i.e., all users would have to be retrieved in order to do the filtering. IMPORTANT: because of this decision, user names must not contain a % character when using this function.

GeneratePassword ( ) : string
GetAllUsers ( int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection

Retrieves a collection of all the users.

GetNumberOfUsersOnline ( ) : int

Get the number of users that are currently online

GetPassword ( string username, string answer ) : string

Gets the password of a user given the provided password answer

GetUser ( object providerUserKey, bool userIsOnline ) : System.Web.Security.MembershipUser

Get a user based on the username parameter. If the userIsOnline parameter is set the lastActivity flag of the user is changed in the data store

GetUser ( string username, bool userIsOnline ) : System.Web.Security.MembershipUser

Retrieves a user based on his/her username. The userIsOnline parameter determines whether to update the lastActivityDate of the user in the data store

GetUserNameByEmail ( string email ) : string

Retrieves a username based on a matching email.

Initialize ( string name, NameValueCollection config ) : void

Initializes the membership provider. This is the only function that cannot be accessed in parallel by multiple applications. The function reads the properties of the provider specified in the Web.config file and stores them in member variables.

ResetPassword ( string username, string answer ) : string

Reset the password of a user. No retry policies are used in this function.

UnlockUser ( string userName ) : bool

Unlock a user

ValidateUser ( string username, string password ) : bool

Returns true if the username and password match an exsisting user. This implementation does not update a user's login time and does not raise corresponding Web events

Private Methods

Method Description
CheckPassword ( DataServiceContext svc, string username, string password, bool updateLastLoginActivityDate, bool failIfNotApproved, MembershipRow &member ) : bool
CheckPassword ( string username, string password, bool updateLastLoginActivityDate, bool failIfNotApproved ) : bool
CheckPassword ( string username, string password, bool updateLastLoginActivityDate, bool failIfNotApproved, MembershipRow &member ) : bool
CreateDataServiceContext ( ) : Microsoft.WindowsAzure.StorageClient.TableServiceContext
EncodePassword ( string pass, int passwordFormat, string salt ) : string
EvaluatePasswordRequirements ( string password ) : bool
FindUsersByEmail ( string emailToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
GenerateSalt ( ) : string
GetUserFromTable ( DataServiceContext svc, string username ) : MembershipRow
IsUniqueEmail ( string email ) : bool
IsUniqueEmail ( string email, MembershipRow &member ) : bool
IsUniqueUserName ( string userName ) : bool
PasswordAttemptWindowAsTimeSpan ( ) : TimeSpan
ProcessGetUserQuery ( TableServiceContext svc, IQueryable query, bool updateLastActivityDate ) : MembershipUser
UnEncodePassword ( string pass, int passwordFormat ) : string
UpdateUser ( MembershipUser updatedUser ) : void

Method Details

ChangePassword() public method

Changes a users password. We don't use retries in this highly security-related function. All errors are exposed to the user of this function.
public ChangePassword ( string username, string oldPassword, string newPassword ) : bool
username string
oldPassword string
newPassword string
return bool

ChangePasswordQuestionAndAnswer() public method

Change the password answer for a user.
public ChangePasswordQuestionAndAnswer ( string username, string password, string newPasswordQuestion, string newPasswordAnswer ) : bool
username string
password string
newPasswordQuestion string
newPasswordAnswer string
return bool

CreateUser() public method

Creates a new user and stores it in the membership table. We do not use retry policies in this highly security-related function. All error conditions are directly exposed to the user.
public CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus &status ) : System.Web.Security.MembershipUser
username string
password string
email string
passwordQuestion string
passwordAnswer string
isApproved bool
providerUserKey object
status MembershipCreateStatus
return System.Web.Security.MembershipUser

DeleteUser() public method

Deletes the user from the membership table. This implementation ignores the deleteAllRelatedData argument
public DeleteUser ( string username, bool deleteAllRelatedData ) : bool
username string
deleteAllRelatedData bool
return bool

FindUsersByName() public method

Find users by their names. The usernameToMatch must be the complete username like frank or can contain a '%' character at the end. A '%' character at the end implies that arbitrary characters can follow. Supporting additional searches right now would be very expensive because the filtering would have to be done on the client side; i.e., all users would have to be retrieved in order to do the filtering. IMPORTANT: because of this decision, user names must not contain a % character when using this function.
public FindUsersByName ( string usernameToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
usernameToMatch string
pageIndex int
pageSize int
totalRecords int
return System.Web.Security.MembershipUserCollection

GeneratePassword() public method

public GeneratePassword ( ) : string
return string

GetAllUsers() public method

Retrieves a collection of all the users.
public GetAllUsers ( int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
pageIndex int
pageSize int
totalRecords int
return System.Web.Security.MembershipUserCollection

GetNumberOfUsersOnline() public method

Get the number of users that are currently online
public GetNumberOfUsersOnline ( ) : int
return int

GetPassword() public method

Gets the password of a user given the provided password answer
public GetPassword ( string username, string answer ) : string
username string
answer string
return string

GetUser() public method

Get a user based on the username parameter. If the userIsOnline parameter is set the lastActivity flag of the user is changed in the data store
public GetUser ( object providerUserKey, bool userIsOnline ) : System.Web.Security.MembershipUser
providerUserKey object
userIsOnline bool
return System.Web.Security.MembershipUser

GetUser() public method

Retrieves a user based on his/her username. The userIsOnline parameter determines whether to update the lastActivityDate of the user in the data store
public GetUser ( string username, bool userIsOnline ) : System.Web.Security.MembershipUser
username string
userIsOnline bool
return System.Web.Security.MembershipUser

GetUserNameByEmail() public method

Retrieves a username based on a matching email.
public GetUserNameByEmail ( string email ) : string
email string
return string

Initialize() public method

Initializes the membership provider. This is the only function that cannot be accessed in parallel by multiple applications. The function reads the properties of the provider specified in the Web.config file and stores them in member variables.
public Initialize ( string name, NameValueCollection config ) : void
name string
config System.Collections.Specialized.NameValueCollection
return void

ResetPassword() public method

Reset the password of a user. No retry policies are used in this function.
public ResetPassword ( string username, string answer ) : string
username string
answer string
return string

UnlockUser() public method

Unlock a user
public UnlockUser ( string userName ) : bool
userName string
return bool

ValidateUser() public method

Returns true if the username and password match an exsisting user. This implementation does not update a user's login time and does not raise corresponding Web events
public ValidateUser ( string username, string password ) : bool
username string
password string
return bool