/// <summary>
        /// Authentication Step 2.
        /// 10.3.2.2. Получение аутентификационного токена
        /// </summary>
        private AuthToken GetToken(OmsApiClient omsClient, AuthResponse authResponse, string signedData)
        {
            var url = omsClient.AuthUrl + "auth/cert/{OmsConnectionID}";

            return(omsClient.Post <AuthToken>(url, new
            {
                uuid = authResponse.UUID,
                data = signedData,
            },
                                              new[]
            {
                new Parameter("OmsConnectionID", OmsConnectionID, ParameterType.UrlSegment),
            }));
        }
        private AuthToken CheckSessionToken(OmsApiClient omsClient)
        {
            if (string.IsNullOrWhiteSpace(SessionToken?.Token))
            {
                // session token is not specified
                return(null);
            }

            try
            {
                // try calling a simple authenticated API method
                var authHeader = FormatAuthHeader(SessionToken);
                var header     = new Parameter(authHeader.Item1, authHeader.Item2, ParameterType.HttpHeader);
                var pong       = omsClient.Ping(header);
                return(SessionToken);
            }
            catch
            {
                // session token is not valid
                return(null);
            }
        }
        /// <summary>
        /// Authentication Step 1.
        /// 10.3.2.1. Запрос авторизации при единой аутентификации
        /// </summary>
        private AuthResponse Authenticate(OmsApiClient omsClient)
        {
            var url = omsClient.AuthUrl + "auth/cert/key";

            return(omsClient.Get <AuthResponse>(url));
        }