Exemplo n.º 1
0
        /// <summary>
        /// Adds "wsse:security" element to a message, or replaces existing element.
        /// </summary>
        /// <param name="request">Request string.</param>
        /// <returns>Request string with added (updated) "wsse:security" element.</returns>
        public string ApplySecurity(string request)
        {
            DeviceEnvironment env  = ContextController.GetDeviceEnvironment();
            DebugInfo         info = ContextController.GetDebugInfo();

            string secureRequest = request;

            if (info.Security == HttpTransport.Interfaces.Security.WS)
            {
                if (!string.IsNullOrEmpty(env.Credentials.UserName))
                {
                    SoapHelper soapHelper = new SoapHelper();
                    secureRequest =
                        soapHelper.ApplySecurity(
                            request,
                            env.Credentials.UserName,
                            env.Credentials.Password,
                            env.Credentials.UseUTCTimeStamp,
                            true);
                }
            }
            else
            {
                SoapHelper soapHelper = new SoapHelper();
                secureRequest = soapHelper.RemoveSecurity(request);
            }
            return(secureRequest);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds "wsse:security" element to a message, or replaces existing element.
        /// </summary>
        /// <param name="request">Request string.</param>
        /// <returns>Request string with added (updated) "wsse:security" element.</returns>
        public string ApplySecurity(string request)
        {
            DeviceEnvironment env = ContextController.GetDeviceEnvironment();

            string secureRequest;

            if (!string.IsNullOrEmpty(env.Credentials.UserName))
            {
                SoapHelper soapHelper = new SoapHelper();
                secureRequest =
                    soapHelper.ApplySecurity(
                        request,
                        env.Credentials.UserName,
                        env.Credentials.Password,
                        env.Credentials.UseUTCTimeStamp,
                        true);
            }
            else
            {
                secureRequest = request;
            }

            return(secureRequest);
        }