LoginService Class
Namespace: PTS.Modules.Logins.Common
Assembly: PTS.Modules.Logins.dll
Syntax
public class LoginService : SingleRepositoryService<Login>, IServiceProviderAccessor, ILoginService, ISeedWork<ILoginService>, ISeedWork
Inheritance
Constructors
LoginService(IUnitOfWork)
Declaration
public LoginService(IUnitOfWork unitOfWork)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnitOfWork | unitOfWork |
Properties
CaseSensitiveUsernameFallback
Gets a value indicating whether the service should have a fallback for case sensitive usernames.
Declaration
public virtual bool CaseSensitiveUsernameFallback { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
CaseSensitiveUsernames
Gets a value indicating whether usernames are case sensitive;
Declaration
public virtual bool CaseSensitiveUsernames { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Methods
GetSalt(Int32)
Gets the salt.
Declaration
public virtual string GetSalt(int size = 10)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | size | The size of salt. |
Returns
| Type | Description |
|---|---|
| System.String | The salt string. |
GetSaltedHash(String, String)
Gets the salted hash of input.
Declaration
public virtual string GetSaltedHash(string input, string salt)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The input. |
| System.String | salt | The salt. |
Returns
| Type | Description |
|---|---|
| System.String | The hash string of the (input+salt). |
GetTextHash(String)
Gets the text hash.
Declaration
public virtual string GetTextHash(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | The input. |
Returns
| Type | Description |
|---|---|
| System.String | The hash string of the input. |
GetUserLogin(Account)
Gets the Login for account.
Declaration
public virtual Login GetUserLogin(Account account)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | The account. |
Returns
| Type | Description |
|---|---|
| Login | The Login. |
GetUserLogin(String)
Gets the Login by the username.
Declaration
public virtual Login GetUserLogin(string username)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| Login | A Login. |
GetUserLoginAsync(Account)
Gets the Login for account.
Declaration
public virtual Task<Login> GetUserLoginAsync(Account account)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | The account. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Login> | A System.Threading.Tasks.Task with result of Login. |
GetUserLoginAsync(String)
Gets the Login by the username.
Declaration
public virtual Task<Login> GetUserLoginAsync(string username)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Login> | A System.Threading.Tasks.Task with result of Login. |
IsUsernameTaken(Login, String)
Gets a value indicating whether the username is taken.
Declaration
public virtual bool IsUsernameTaken(Login login, string username)
Parameters
| Type | Name | Description |
|---|---|---|
| Login | login | |
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUsernameTaken(String)
Gets a value indicating whether the username is taken.
Declaration
public virtual bool IsUsernameTaken(string username)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUsernameTakenAsync(Login, String)
Gets a value indicating whether the username is taken.
Declaration
public virtual Task<bool> IsUsernameTakenAsync(Login login, string username)
Parameters
| Type | Name | Description |
|---|---|---|
| Login | login | |
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> |
|
IsUsernameTakenAsync(String)
Gets a value indicating whether the username is taken.
Declaration
public virtual Task<bool> IsUsernameTakenAsync(string username)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | username | The username. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> |
|
SetLogin(Account, String, String, Nullable<DateTime>)
Sets the Login for account.
Declaration
public virtual Login SetLogin(Account account, string username, string password = null, DateTime? expiresOn = default(DateTime? ))
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | The account. |
| System.String | username | The username. |
| System.String | password | The password. |
| System.Nullable<System.DateTime> | expiresOn | The expires on. |
Returns
| Type | Description |
|---|---|
| Login | The Login. |
SetLoginAsync(Account, String, String, Nullable<DateTime>)
Sets the Login for account.
Declaration
public virtual Task<Login> SetLoginAsync(Account account, string username, string password = null, DateTime? expiresOn = default(DateTime? ))
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | The account. |
| System.String | username | The username. |
| System.String | password | The password. |
| System.Nullable<System.DateTime> | expiresOn | The expires on. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Login> | A System.Threading.Tasks.Task with result of Login. |
SetPassword(Login, String, Boolean)
Sets the password for login.
Declaration
public virtual void SetPassword(Login login, string password, bool update = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Login | login | The login. |
| System.String | password | The password. |
| System.Boolean | update |
|
SetUsername(Login, String, Boolean)
Sets the username for login.
Declaration
public virtual void SetUsername(Login login, string username, bool update = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Login | login | The login. |
| System.String | username | The username. |
| System.Boolean | update |
|
ValidatePassword(Login, String)
Validates the password for Login.
Declaration
public virtual bool ValidatePassword(Login login, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| Login | login | The login. |
| System.String | password | The password. |
Returns
| Type | Description |
|---|---|
| System.Boolean |