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

            return(new BearerAuthenticator(authData.JsonWebToken));
        }
Exemplo n.º 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);
        }