To authenticate a user you must perform the following:
- Acquire the username and the password.
Make the user input his username and password.
- Authenticate the user.
To authenticate the user, call the AuthenticateUser static method of the SecurityManager and pass the required arguments. The method returns a enumeration value of type UserLoggingReason. The enumeration has the following values:
The AuthenticateUser method accepts the following parameters:
The user is successfully authenticated.
The limit of maximum simultaneous logged in users is reached.
User cannot be found in any provider.
User is already logged in from different IP address.
Indicates that the user’s session has expired.
The user have the authentication cookie, but is not logged in the database or is already logged out.
More than one user are trying to login from the same IP but from different computers.
The username or the password is invalid.
The user is not administrator to logout other users.
User already is logged in. You need to ask the user to logout someone or himself.
User was revoked. The reason is that the user was deleted or user rights and role membership was changed.
Represents the name of the membership provider for the user. To specify the default provider pass null.
Represents the username of the user.
Represents the password of the user.
Specify whether the user to be remembered on this computer.
TIP: You can wrap these parameters inside an instance of the Credentials class.
Here is a code example:
UserLoggingReason result = SecurityManager.AuthenticateUser(
, username, password,