internal override HttpRequestMessageBuilder BuildRequest(HttpRequestMessageBuilder requestMessageBuilder) { if (string.IsNullOrEmpty(PolicyJsonString)) { new MinioException("SetPolicyArgs needs the policy to be set to the right JSON contents."); } requestMessageBuilder.AddQueryParameter("policy", ""); requestMessageBuilder.AddJsonBody(PolicyJsonString); return(requestMessageBuilder); }
public void TestAnonymousSecureRequestHeaders() { //test anonymous secure request headers var authenticator = new V4Authenticator(true, null, null); Assert.IsTrue(authenticator.isAnonymous); var request = new HttpRequestMessageBuilder(HttpMethod.Put, "http://localhost:9000/bucketname/objectname"); request.AddJsonBody("[]"); authenticator.Authenticate(request); Assert.IsFalse(hasPayloadHeader(request, "x-amz-content-sha256")); Assert.IsTrue(hasPayloadHeader(request, "Content-MD5")); }
public void TestInsecureRequestHeaders() { // insecure authenticated requests var authenticator = new V4Authenticator(false, "accesskey", "secretkey"); Assert.IsFalse(authenticator.isSecure); Assert.IsFalse(authenticator.isAnonymous); var request = new HttpRequestMessageBuilder(HttpMethod.Put, "http://localhost:9000/bucketname/objectname"); request.AddJsonBody("[]"); authenticator.Authenticate(request); Assert.IsTrue(hasPayloadHeader(request, "x-amz-content-sha256")); Assert.IsFalse(hasPayloadHeader(request, "Content-Md5")); }
public void TestSecureRequestHeaders() { // secure authenticated requests var authenticator = new V4Authenticator(true, "accesskey", "secretkey"); Assert.IsTrue(authenticator.isSecure); Assert.IsFalse(authenticator.isAnonymous); var request = new HttpRequestMessageBuilder(HttpMethod.Put, "http://localhost:9000/bucketname/objectname"); request.AddJsonBody("[]"); authenticator.Authenticate(request); Assert.IsTrue(hasPayloadHeader(request, "x-amz-content-sha256")); var match = GetHeaderKV(request, "x-amz-content-sha256"); Assert.IsTrue(match != null && match.Item2.Equals("UNSIGNED-PAYLOAD")); }