public void can_use_client_created_with_getsecretfromkey_implementation_to_set_signature() { var mockGetSecretFromKey = new Mock <IGetSecretFromUsername>(); mockGetSecretFromKey.Setup(x => x.Secret("anyusername")) .Returns("secret"); client = HeimdallClientFactory.Create("anyusername", mockGetSecretFromKey.Object); client.BaseAddress = new Uri("http://localhost:8080"); testSignature(); }
private static HttpResponseMessage SendSignedPostRequest() { HttpClient client = HeimdallClientFactory.Create("myusername", "mysecret"); var content = new FormUrlEncodedContent( new[] { new KeyValuePair <string, string>("firstName", "Alex"), new KeyValuePair <string, string>("lastName", "Brown") }); return(client.PostAsync("http://requestb.in/14nmm871", content).Result); }
private static void Unsuccesful_Authentication() { Console.WriteLine("***** Showing a message signed with a different key and not authenticated server side... *****"); var client = HeimdallClientFactory.Create("username", "different_secret"); var response = client.PostAsync("http://localhost:8080/api/values", new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("a", "b"), })).Result; Console.WriteLine("Request: "); Console.WriteLine(response.RequestMessage); Console.WriteLine("Response: "); Console.WriteLine(response); Console.WriteLine(); }
private static HttpClient CreateClient() { var client = HeimdallClientFactory.Create("username", "secret"); return(client); }
public void SetUp() { client = HeimdallClientFactory.Create("anyusername", "secret"); client.BaseAddress = new Uri("http://localhost:8080"); }
public static HttpClient CreateSignedClient() { var client = HeimdallClientFactory.Create("username", "secret"); return(client); }