private Response <T> Post <T>(string url, IDictionary <string, string> bodyArguments)
        {
            var bodyArgs = bodyArguments != null && bodyArguments.Any()
                               ? bodyArguments.Select(x => string.Format("{0}={1}", x.Key, x.Value)).ToList()
                               : new List <string>();

            IRestService rs       = new JsonRestServices(null, new RequestRetryLogic(), new UrlBuilder(), new XmlStringSerializer());
            Response <T> response = rs.Execute <T>(url, HttpMethod.POST, string.Join("&", bodyArgs), settings: EveRequestSettings);

            return(response);
        }
        public CloudIdentityProviderFactory(CloudIdentity defaultIdentity, IRestService restService, ICache <UserAccess> tokenCache, string usInstanceUrlBase, string ukInstanceUrlBase)
        {
            if (restService == null)
            {
                restService = new JsonRestServices();
            }

            if (tokenCache == null)
            {
                tokenCache = UserAccessCache.Instance;
            }

            USIdentityUrlBase  = string.IsNullOrWhiteSpace(usInstanceUrlBase) ? "https://identity.api.rackspacecloud.com" : usInstanceUrlBase;
            LONIdentityUrlBase = string.IsNullOrWhiteSpace(ukInstanceUrlBase) ? "https://lon.identity.api.rackspacecloud.com" : ukInstanceUrlBase;

            _restService     = restService;
            _tokenCache      = tokenCache;
            _defaultIdentity = defaultIdentity;
        }
Example #3
0
        protected ProviderBase(CloudIdentity defaultIdentity, IIdentityProvider identityProvider, IRestService restService, IHttpResponseCodeValidator httpStatusCodeValidator)
        {
            if (identityProvider == null)
            {
                identityProvider = new CloudIdentityProvider(defaultIdentity);
            }

            if (restService == null)
            {
                restService = new JsonRestServices();
            }

            if (httpStatusCodeValidator == null)
            {
                httpStatusCodeValidator = HttpResponseCodeValidator.Default;
            }

            DefaultIdentity       = defaultIdentity;
            IdentityProvider      = identityProvider;
            RestService           = restService;
            ResponseCodeValidator = httpStatusCodeValidator;
        }