Skip to main content

AuthenticationService

A class in Alta.Platform.Generic, Alta.Platform.Generic.

Authentication for the generic platform (Windows and the server build): logs in to the Alta API with command line arguments, a refresh token or editor credentials. Platform login and linking aren't supported.

Constructors​

MemberWhat it is
AuthenticationService(IHighLevelApiClient apiClient, IAuthenticationUtility authenticationUtility)Creates an AuthenticationService from apiClient and authenticationUtility.

Fields​

3 private and internal fields
MemberWhat it is
private readonly IHighLevelApiClient apiClientThe high-level Alta API client.
private readonly IAuthenticationUtility authenticationUtilityHelper that does the actual login calls.
private static readonly Logger loggerNLog logger for this class.

Properties​

MemberWhat it is
bool ExternalPlatformSigninRequired { get; }Always false.
IAuthenticationFeatures Features { get; }An AuthenticationFeatures with everything off.
1 private and internal property
MemberWhat it is
private bool IsLoggedIn { get; }True when the API client has a logged-in user.

Methods​

MemberWhat it is
async Task<IResult> AutoLoginAsync()Does nothing if already logged in; otherwise tries editor override credentials, then command line arguments, then the saved refresh token.
Task<IResult<string>> GetAccessToken()Always returns an error; platform access tokens aren't supported here.
async Task<IResult<string>> GetAccessToken(bool forceRefresh)Always returns an error; platform access tokens aren't supported here.
Task<IResult> LinkPlatformAccount()Throws NotSupportedException.
Task<IResult> LoginWithPlatformCredentials()Throws NotSupportedException.
async Task<IResult<UserInfo>> RegisterAccount(string username, string password, string email, string referral)Hashes the password and registers a new Alta account through the API, returning the new user's info.
Task<IResult> UnlinkPlatformAccount()Throws NotSupportedException.
1 private and internal method
MemberWhat it is
private async Task<IResult> LoginUsingEditorOverrideCredentials()Editor only: logs in with the username and password from the editor API settings. Called by AutoLoginAsync.