-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathIProvider.cs
More file actions
63 lines (54 loc) · 2.15 KB
/
Copy pathIProvider.cs
File metadata and controls
63 lines (54 loc) · 2.15 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace CommunityToolkit.Authentication
{
/// <summary>
/// Authentication provider to expose more states around the authentication process for graph controls.
/// </summary>
public interface IProvider
{
/// <summary>
/// Gets the current login state of the provider.
/// </summary>
ProviderState State { get; }
/// <summary>
/// Gets the id of the currently signed in user account.
/// </summary>
string CurrentAccountId { get; }
/// <summary>
/// Event called when the login <see cref="State"/> changes.
/// </summary>
event EventHandler<ProviderStateChangedEventArgs> StateChanged;
/// <summary>
/// Authenticate an outgoing request.
/// </summary>
/// <param name="request">The request to authenticate.</param>
/// <returns>A task upon completion.</returns>
Task AuthenticateRequestAsync(HttpRequestMessage request);
/// <summary>
/// Retrieve a token for the authenticated user.
/// </summary>
/// <param name="silentOnly">Determines if the acquisition should be done without prompts to the user.</param>
/// <returns>A token string for the authenticated user.</returns>
Task<string> GetTokenAsync(bool silentOnly = false);
/// <summary>
/// Sign in the user.
/// </summary>
/// <returns><see cref="Task"/>.</returns>
Task SignInAsync();
/// <summary>
/// Sign out the user.
/// </summary>
/// <returns><see cref="Task"/>.</returns>
Task SignOutAsync();
/// <summary>
/// Tries to check if the user is logged in without prompting to login.
/// </summary>
/// <returns>A boolean indicating success or failure to sign in silently.</returns>
Task<bool> TrySilentSignInAsync();
}
}