public static RouteValidationResponse CreateSuccess(IdentityModel identity, RouteInfo result) { return(new RouteValidationResponse { Identity = identity, Status = HttpStatusCode.OK, ValidRoute = result }); }
public static async Task <ResolvedServicePartition> ResolvedServicePartition(HttpContext context, IdentityModel identity, RouteInfo validRoute, ServicePartitionResolver resolver) { var partitionKey = identity.OrganizationPrefix; var resolvedKey = PartitionResolver.Resolve(partitionKey); var servicePartitionKey = validRoute.IsPartitioned ? new ServicePartitionKey(resolvedKey) : ServicePartitionKey.Singleton; var resolved = await resolver .ResolveAsync(new Uri(validRoute.ServiceUri), servicePartitionKey, context.RequestAborted) .ConfigureAwait(false); return(resolved); }
private static async Task <HttpResponseMessage> MakeServiceCallAsync(string endpoint, HttpContext context, byte[] contextRequestBody, IdentityModel identity) { var uriString = endpoint + context.Request.Path + context.Request.QueryString; var req = new HttpRequestMessage { Method = new HttpMethod(context.Request.Method), RequestUri = new Uri(uriString, UriKind.Absolute) }; if (contextRequestBody != null) { req.Content = new ByteArrayContent(contextRequestBody); } req.CopyHeadersFromCurrentContext(context); req.AddProxyHeaders(context); var identityModelSafeString = Helpers.Base64Encode(JsonConvert.SerializeObject(identity)); req.Headers.Add("x-identity-model", identityModelSafeString); // execute request var response = await Client.SendAsync(req, context.RequestAborted).ConfigureAwait(false); return(response); }