private static IAuthenticator GetAuthenticator(AuthenticationDataResponse authData) { if (authData is null || authData.IsCookieEnabled) { return(new TmsAuthenticator()); } return(new BearerAuthenticator(authData.JsonWebToken)); }
private void RestoreSession() { Log.Debug("Restoring session"); Client.CookieContainer = CookieUtils.ReadCookiesFromDisk(_cookiPath); AuthData = AuthenticationDataResponse.NewInstance(_dataPath); IsAuthenticated = AuthData is not null; Client.Authenticator = GetAuthenticator(AuthData); }