public Uri GetUrlWithAdvancedAuthentication(RequestType action, NameValueCollection parameters) { EnsureChannelParameter(parameters); var config = ConnectionSection.GetSection(); string timestamp = Clock.Now().ToString(); parameters["timestamp"] = timestamp; parameters["username"] = config.Authentication.UserName; parameters["password"] = ( config.Authentication.Prefix + timestamp + config.Authentication.Password.ToMD5() + config.Authentication.Postfix ).ToMD5(); return new Uri(String.Format( "{0}://{1}:{2}/{3}/{4}?{5}", config.Protocol, config.ServerAddress, config.Port, config.Context, action, parameters.ToUriQueryString() )); }
public Uri GetUrlWithAuthentication(RequestType action, NameValueCollection parameters) { var config = ConnectionSection.GetSection(); switch (config.Authentication.Type) { case AuthenticationType.Http: return GetUrlWithHttpAuthentication(action, parameters); case AuthenticationType.Basic: return GetUrlWithSimpleAuthentication(action, parameters); case AuthenticationType.Advanced: return GetUrlWithAdvancedAuthentication(action, parameters); default: throw new Exception("Invalid authentication type configured."); } }
public Uri GetUrlWithoutAuthentication(RequestType action, NameValueCollection parameters) { EnsureChannelParameter(parameters); var config = ConnectionSection.GetSection(); return new Uri(String.Format( "{0}://{1}:{2}/{3}/{4}?{5}", config.Protocol, config.ServerAddress, config.Port, config.Context, action, parameters.ToUriQueryString() )); }