Exemple #1
0
        private static IAuthenticator GetAuthenticator(AuthenticationDataResponse authData)
        {
            if (authData is null || authData.IsCookieEnabled)
            {
                return(new TmsAuthenticator());
            }

            return(new BearerAuthenticator(authData.JsonWebToken));
        }
Exemple #2
0
        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);
        }