示例#1
0
        public ExternalIdentityProviderDto Create(ServerDto server, string tenantName, ExternalIdentityProviderDto externalIdentityProvider, Token token)
        {
            tenantName = Uri.EscapeDataString(tenantName);
            var url  = string.Format(_serviceConfigManager.GetExternalIdentityProvidersEndPoint(), server.Protocol, server.ServerName, server.Port, tenantName);
            var dto  = typeof(ExternalIdentityProviderDto).Assembly;
            var json = JsonConvert.Serialize(externalIdentityProvider, true);

            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            var requestConfig = new RequestSettings
            {
                Method = HttpMethod.Post,
            };
            var headers = ServiceHelper.AddHeaders(ServiceConstants.JsonContentType);

            json = "access_token=" + token.AccessToken + "&token_type=" + token.TokenType.ToString().ToLower() + "&" + json;
            var response = _webRequestManager.GetResponse(url, requestConfig, headers, null, json);

            return(JsonConvert.Deserialize <ExternalIdentityProviderDto>(response));
        }