//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading.Tasks;
using Microsoft.SqlTools.ResourceProvider.Core.Extensibility;
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
///
/// An account manager has the information of currently logged in user and can authenticate the user
/// Implementing classes must add a
/// to the class in order to be found by the extension manager,
/// and to define the type and category supported
///
public interface IAccountManager : IExportable
{
///
/// Returns true is user needs reauthentication
///
Task GetUserNeedsReauthenticationAsync();
///
/// Authenticates the user
///
Task AuthenticateAsync();
///
/// Prompt the login dialog to login to a new use that has not been cached
///
Task AddUserAccountAsync();
///
/// Set the current loaged in user in the cache
///
Task SetCurrentAccountAsync(object account);
///
/// Returns the current logged in user
///
Task GetCurrentAccountAsync();
///
/// Returns true if the API supports a login control
///
bool HasLoginDialog
{
get;
}
///
/// Event to raise when the current logged in user changed
///
event EventHandler CurrentAccountChanged;
}
}