Exemplo n.º 1
0
        public void Authentication_Param_Check()
        {
            string            token      = "your_token";
            string            expire     = "1582269249";
            AuthParamResponse authParams = imagekit.GetAuthenticationParameters(token, expire);

            Assert.Equal(token, authParams.token);
            Assert.Equal(expire, authParams.expire);
            Assert.Equal("e71bcd6031016b060d349d212e23e85c791decdd", authParams.signature);
        }
Exemplo n.º 2
0
 public static Action<HttpRequestMessage> GetUploadRequestMessageValidator(
     string fileUrl,
     string fileName,
     string publicKey = null,
     AuthParamResponse clientAuth = null
 )
 {
     return async (msg) =>
     {
         var contentBodyLines = await GetMultipartFormBodyContent(msg);
         CheckMultipartFormData(contentBodyLines, "file", fileUrl);
         CheckMultipartFormData(contentBodyLines, "fileName", fileName);
         if (clientAuth != null)
         {
             CheckMultipartFormData(contentBodyLines, "signature", clientAuth.signature);
             CheckMultipartFormData(contentBodyLines, "token", clientAuth.token);
             CheckMultipartFormData(contentBodyLines, "expire", clientAuth.expire);
             CheckMultipartFormData(contentBodyLines, "publicKey", publicKey);
         }
     };
 }