예제 #1
0
            public void WhenRequestHasAnAuthorizationHeaderWithoutParam_ReturnsFailure()
            {
                _request.Headers["Authorization"] = _options.Scheme + " ";

                SignatureParsingResult actual = null;
                Action act = () => actual = _sut.Parse(_request, _options);

                act.Should().NotThrow();
                actual.Should().BeAssignableTo <SignatureParsingFailure>();
                actual.IsSuccess.Should().BeFalse();
            }
예제 #2
0
            public void WhenRequestHasAnAuthorizationHeaderForAnotherScheme_ReturnsFailure()
            {
                SetHeader(_request, "app1", "rsa-sha256", _nowEpoch.ToString(), _expiresEpoch.ToString(), "(request-target) date content-length", "xyz123==", "abc123", "SomethingElse");

                SignatureParsingResult actual = null;
                Action act = () => actual = _sut.Parse(_request, _options);

                act.Should().NotThrow();
                actual.Should().BeAssignableTo <SignatureParsingFailure>();
                actual.IsSuccess.Should().BeFalse();
            }
예제 #3
0
            public void GivenDuplicateSignature_ReturnsFailure()
            {
                SetHeader(_request, "app1", "rsa-sha256", _nowEpoch.ToString(), _expiresEpoch.ToString(), "(request-target) date content-length", "xyz123==", "abc123", _options.Scheme, "signature=\"xyz987==\"");

                SignatureParsingResult actual = null;
                Action act = () => actual = _sut.Parse(_request, _options);

                act.Should().NotThrow();
                actual.Should().BeAssignableTo <SignatureParsingFailure>();
                actual.IsSuccess.Should().BeFalse();
            }
예제 #4
0
            public void WhenRequestHasNoAuthorizationHeader_ReturnsFailure()
            {
                _request.Headers.Clear();

                SignatureParsingResult actual = null;
                Action act = () => actual = _sut.Parse(_request, _options);

                act.Should().NotThrow();
                actual.Should().BeAssignableTo <SignatureParsingFailure>();
                actual.IsSuccess.Should().BeFalse();
            }
예제 #5
0
            public void WhenStringNotSpecified_ReturnsFailure()
            {
                SetHeader(_request, "app1", "rsa-sha256", _nowEpoch.ToString(), _expiresEpoch.ToString(), "(request-target) date content-length", null, "abc123", _options.Scheme);

                SignatureParsingResult actual = null;
                Action act = () => actual = _sut.Parse(_request, _options);

                act.Should().NotThrow();
                actual.Should().BeAssignableTo <SignatureParsingFailure>();
                actual.IsSuccess.Should().BeFalse();
            }