Пример #1
0
        public void UsePoliciesToCreateSasTokens()
        {
            var policy = SASPolicyFactory.CreatePolicy("a", "This is a valid secret", 60);
            var token  = SasTokenFactory.Create("CalculateThis", policy);

            Assert.NotNull(token);
            var queryString = token.ToQueryString();

            _outputHelper.WriteLine(queryString);
        }
Пример #2
0
        public void AcceptPolicyToValidateQuerystring()
        {
            var policy      = SASPolicyFactory.CreatePolicy("a", "This is a valid secret", 60);
            var token       = SasTokenFactory.Create("CalculateThis", policy);
            var queryString = token.ToQueryString();

            var validator        = new SasTokenValidator(policy);
            var validationResult = validator.Validate(queryString);

            Assert.True(validationResult.Success);
        }