Exemplo n.º 1
0
        private bool CheckUploadAuthentication(out string error)
        {
            error = string.Empty;

            if (!CheckCredentialsEntered())
                return false;

            var action = new CallHomeAuthenticationAction(pool, textBoxMyCitrixUsername.Text.Trim(), textBoxMyCitrixPassword.Text.Trim(),
                Registry.CallHomeIdentityTokenDomainName, Registry.CallHomeUploadGrantTokenDomainName, Registry.CallHomeUploadTokenDomainName,
                true, 0, false);

            try
            {
                action.RunExternal(null);
            }
            catch
            {
                error = action.Exception != null ? action.Exception.Message : Messages.ERROR_UNKNOWN;
                authenticationToken = null;
                authenticated = false;
                return authenticated;
            }

            authenticationToken = action.UploadToken;  // curent upload token
            authenticated = !string.IsNullOrEmpty(authenticationToken);
            authenticationToken = pool.CallHomeSettings.GetExistingSecretyInfo(pool.Connection, CallHomeSettings.UPLOAD_TOKEN_SECRET);
            return authenticated;
        }
Exemplo n.º 2
0
        private bool CheckUploadAuthentication(out string error)
        {
            error = string.Empty;

            if (!uploadCheckBox.Checked)
                return true;

            if (string.IsNullOrEmpty(usernameTextBox.Text) || string.IsNullOrEmpty(passwordTextBox.Text))
                return false;

            var action = new CallHomeAuthenticationAction(null, usernameTextBox.Text.Trim(), passwordTextBox.Text.Trim(),
                Registry.CallHomeIdentityTokenDomainName, Registry.CallHomeUploadGrantTokenDomainName, Registry.CallHomeUploadTokenDomainName,
                false, TokenExpiration, false);

            try
            {
                action.RunExternal(null);
            }
            catch
            {
                error = action.Exception != null ? action.Exception.Message : Messages.ERROR_UNKNOWN;
                UploadToken = null;
                return false;
            }

            UploadToken = action.UploadToken;  // curent upload token
            return !string.IsNullOrEmpty(UploadToken);
        }