aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs
blob: ca927e6df252ec985f5a05cbc4cbe4b762a8eb29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;

namespace Tango.PPC.Common.Authentication
{
    /// <summary>
    /// Represents the user authentication provider responsible for the current logged-in user.
    /// </summary>
    public interface IAuthenticationProvider
    {
        /// <summary>
        /// Occurs when the current logged-in user has changed.
        /// </summary>
        event EventHandler<User> CurrentUserChanged;

        /// <summary>
        /// Gets the current logged-in user.
        /// </summary>
        User CurrentUser { get; }

        /// <summary>
        /// Gets a value indicating whether the authentication provider is using a null user.
        /// </summary>
        bool AuthenticationRequired { get; }

        /// <summary>
        /// Performs a user login by the specified email and password.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="password">The password.</param>
        /// <param name="encrypt">Determines whether to encrypt the provided password before attempting to login</param>
        /// <returns></returns>
        Task<User> Login(String email, String password, bool encrypt = true);

        /// <summary>
        /// Performs a fake login when no authentication is used.
        /// </summary>
        /// <returns></returns>
        Task Login();

        /// <summary>
        /// Logs-out the current logged-in user.
        /// </summary>
        void LogOut();
    }
}