Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchAsteriskAtStart()
        public virtual void ShouldMatchAsteriskAtStart()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("*/some/uri/path");

            assertTrue(matcher.Matches("anything/i/like/followed/by/some/uri/path"));
            assertFalse(matcher.Matches("anything/i/like/followed/by/some/deliberately/changed/to/fail/uri/path"));
        }
Пример #2
0
        public SecurityFilter(IEnumerable <SecurityRule> securityRules)
        {
            // For backwards compatibility
            foreach (SecurityRule r in securityRules)
            {
                string rulePath = r.ForUriPath();
                if (!rulePath.EndsWith("*", StringComparison.Ordinal))
                {
                    rulePath = rulePath + "*";
                }

                UriPathWildcardMatcher           uriPathWildcardMatcher = new UriPathWildcardMatcher(rulePath);
                HashSet <ForbiddingSecurityRule> ruleHashSet            = _rules.computeIfAbsent(uriPathWildcardMatcher, k => new HashSet <ForbiddingSecurityRule>());
                ruleHashSet.Add(FromSecurityRule(r));
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchMultipleAsterisksAtEndAndInMiddle()
        public virtual void ShouldMatchMultipleAsterisksAtEndAndInMiddle()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("/some/uri/path/*/and/some/more/*/and/a/final/bit/*");

            assertTrue(matcher.Matches("/some/uri/path/with/middle/bit/and/some/more/with/additional/asterisk/part/and/a/final/bit/and/now" + "/some/post/amble"));
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchMultipleAsterisksAtStartAndInMiddle()
        public virtual void ShouldMatchMultipleAsterisksAtStartAndInMiddle()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("*/some/uri/path/*/and/some/more/*/and/a/final/bit");

            assertTrue(matcher.Matches("a/bit/of/preamble/and/then/some/uri/path/with/middle/bit/and/some/more/with/additional/asterisk" + "/part/and/a/final/bit"));
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchAsteriskInMiddle()
        public virtual void ShouldMatchAsteriskInMiddle()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("/some/uri/path/*/and/some/more");

            assertTrue(matcher.Matches("/some/uri/path/with/middle/bit/and/some/more"));
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchAsteriskAtEnd()
        public virtual void ShouldMatchAsteriskAtEnd()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("/some/uri/path/*");

            assertTrue(matcher.Matches("/some/uri/path/followed/by/anything/i/like"));
        }
Пример #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWithoutAsteriskAtEnd()
        public virtual void ShouldFailWithoutAsteriskAtEnd()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("/some/uri/path/and/some/more");

            assertFalse(matcher.Matches("/some/uri/path/with/middle/bit/and/some/more"));
        }
Пример #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWithoutAsteriskAtStart()
        public virtual void ShouldFailWithoutAsteriskAtStart()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("/some/uri/path");

            assertFalse(matcher.Matches("preamble/some/uri/path"));
        }
Пример #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailToMatchMultipleSimpleStringWithATrailingWildcard()
        public virtual void ShouldFailToMatchMultipleSimpleStringWithATrailingWildcard()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("str*");

            assertFalse(matcher.Matches("my_str"));
        }
Пример #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchMultipleSimpleStringWithALeadingWildcard()
        public virtual void ShouldMatchMultipleSimpleStringWithALeadingWildcard()
        {
            UriPathWildcardMatcher matcher = new UriPathWildcardMatcher("*str");

            assertTrue(matcher.Matches("my_str"));
        }