# Interface ILoginService

Namespace
  adas_core.Authentication.Interfaces

Assembly
  adas-core.Authentication.dll

    public interface ILoginService

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Properties

### AllowPassword

    bool AllowPassword { get; }

#### Property Value

bool

### Method

    UserEnum.LoginMethod Method { get; }

#### Property Value

UserEnum.LoginMethod

## Methods

### Authenticate(string, string)

Authenticates a user based on the provided credentials.

    Task<User> Authenticate(string username, string password)

#### Parameters

`username` string

  The username of the user to authenticate.

`password` string

  The password of the user to authenticate.

#### Returns

Task<User>

  A task that represents the asynchronous operation. The task result contains the authenticated User.

### GetAllUsers()

Asynchronously retrieves a list of all users in the system.

    Task<List<User>> GetAllUsers()

#### Returns

Task<List<User>>

  A task that represents the asynchronous operation, containing a list of all User entities.

### GetByEmail(string)

Retrieves a user from the data store by their email address, or returns null if no matching user is found.

    Task<User?> GetByEmail(string email)

#### Parameters

`email` string

  The email address used to look up the user.

#### Returns

Task<User>

  A task that resolves to the User matching the provided email, or null if no user is found.

### GetById(ObjectId)

Retrieves a user by their unique identifier, returning null if no matching user is found.

    Task<User?> GetById(ObjectId id)

#### Parameters

`id` ObjectId

  The unique identifier of the user to look up.

#### Returns

Task<User>

  The user with the specified identifier, or null if no user is found.

### GetByUsername(string)

Retrieves a user by their username asynchronously, returning `null` if no matching user is found.

    Task<User?> GetByUsername(string username)

#### Parameters

`username` string

  The username to look up.

#### Returns

Task<User>

  A Task<TResult> that resolves to the matching User, or `null` if no user exists with the specified username.

### Login(HttpContext)

Authenticates a user based on the provided HTTP context.

    Task<User> Login(HttpContext context)

#### Parameters

`context` HttpContext

  The HTTP context containing the request information used to perform the login.

#### Returns

Task<User>

  A task that represents the asynchronous login operation. The task result contains the authenticated User.

### Login(string, string)

Authenticates a user with the provided credentials and returns the corresponding user account.

    Task<User> Login(string username, string password)

#### Parameters

`username` string

  The username of the user attempting to log in.

`password` string

  The password associated with the username.

#### Returns

Task<User>

  A Task<TResult> representing the asynchronous operation, containing the authenticated User.