C# Class Candor.Security.UserManager

The user manager is a singleton access point to get to the collection of configured UserProvider. If the providers are already configured via code configuration then this manager class will get the providers from there. If they are not configured by code then the providers must be defined in the configuration file for the AppDomain.
显示文件 Open project: michael-lang/candor-common

Public Methods

Method Description
AuthenticateUser ( string token, UserSessionDurationType duration, String ipAddress, ExecutionResults result ) : UserIdentity

Authenticates against the data store and returns a UserIdentity given a token returned from a previous authentication.

AuthenticateUser ( string name, string password, UserSessionDurationType duration, string ipAddress, ExecutionResults result ) : UserIdentity

Authenticates against the data store and returns a UserIdentity given a user name, and password.

GenerateUserResetCode ( String name ) : String

Generates a new password reset code for a user and stores that as the current code valid for the next hour.

GetLatestUserSessions ( System.Guid userId, Int32 take ) : List

Gets the latest session(s) for a given user.

GetUserByID ( System.Guid userID ) : User

Gets a user by identity.

GetUserByName ( string name ) : User

Gets a user by name.

InvalidateSession ( string token, String ipAddress, ExecutionResults result ) : void

Invalidates a session token so it can no longer be used.

RegisterUser ( User user, UserSessionDurationType duration, String ipAddress, ExecutionResults result ) : UserIdentity

Registers a new user. The PasswordHash property should be the actual password.

UpdateUser ( User item, String currentPassword, String ipAddress, ExecutionResults result ) : bool

updates a user's name and/or password.

ValidateEmailAddressFormat ( string emailAddress ) : bool

Validates that a string is a valid email address format.

ValidateName ( string name, ExecutionResults result ) : bool

Validates that the specified name meets minimum requirements.

ValidatePassword ( string password, ExecutionResults results ) : bool

Validates that a password meets minimum requirements.

Method Details

AuthenticateUser() public static method

Authenticates against the data store and returns a UserIdentity given a token returned from a previous authentication.
public static AuthenticateUser ( string token, UserSessionDurationType duration, String ipAddress, ExecutionResults result ) : UserIdentity
token string The unique token.
duration UserSessionDurationType The amount of time that the renewed token will be valid.
ipAddress String The internet address where the user is connecting from.
result ExecutionResults A ExecutionResults instance to add applicable /// warning and error messages to.
return UserIdentity

AuthenticateUser() public static method

Authenticates against the data store and returns a UserIdentity given a user name, and password.
public static AuthenticateUser ( string name, string password, UserSessionDurationType duration, string ipAddress, ExecutionResults result ) : UserIdentity
name string The unique user name.
password string The matching password.
duration UserSessionDurationType The amount of time that the issued token will be valid.
ipAddress string The internet address where the user is connecting from.
result ExecutionResults A ExecutionResults instance to add applicable /// warning and error messages to.
return UserIdentity

GenerateUserResetCode() public static method

Generates a new password reset code for a user and stores that as the current code valid for the next hour.
public static GenerateUserResetCode ( String name ) : String
name String The user name / email address.
return String

GetLatestUserSessions() public static method

Gets the latest session(s) for a given user.
public static GetLatestUserSessions ( System.Guid userId, Int32 take ) : List
userId System.Guid The unique identity.
take System.Int32 The maximum number of sessions to retrieve.
return List

GetUserByID() public static method

Gets a user by identity.
public static GetUserByID ( System.Guid userID ) : User
userID System.Guid The unique identity.
return User

GetUserByName() public static method

Gets a user by name.
public static GetUserByName ( string name ) : User
name string The unique sign in name.
return User

InvalidateSession() public static method

Invalidates a session token so it can no longer be used.
public static InvalidateSession ( string token, String ipAddress, ExecutionResults result ) : void
token string
ipAddress String
result ExecutionResults
return void

RegisterUser() public static method

Registers a new user. The PasswordHash property should be the actual password.
public static RegisterUser ( User user, UserSessionDurationType duration, String ipAddress, ExecutionResults result ) : UserIdentity
user User A user with a raw password which is turned into a password hash as part of registration.
duration UserSessionDurationType The amount of time that the initial session will be valid.
ipAddress String The internet address where the user is connecting from.
result ExecutionResults A ExecutionResults instance to add applicable /// warning and error messages to.
return UserIdentity

UpdateUser() public static method

updates a user's name and/or password.
public static UpdateUser ( User item, String currentPassword, String ipAddress, ExecutionResults result ) : bool
item User The user details to be saved. If Password is empty is it not changed. If specified it should be the new raw password (not a hash).
currentPassword String The current raw password for the user used to authenticate that the change can be made.
ipAddress String The internet address where the user is connecting from.
result ExecutionResults A ExecutionResults instance to add applicable /// warning and error messages to.
return bool

ValidateEmailAddressFormat() public static method

Validates that a string is a valid email address format.
public static ValidateEmailAddressFormat ( string emailAddress ) : bool
emailAddress string
return bool

ValidateName() public static method

Validates that the specified name meets minimum requirements.
public static ValidateName ( string name, ExecutionResults result ) : bool
name string The desired name/alias.
result ExecutionResults Any error messages about the desired name.
return bool

ValidatePassword() public static method

Validates that a password meets minimum requirements.
public static ValidatePassword ( string password, ExecutionResults results ) : bool
password string
results ExecutionResults
return bool