Package org.springframework.security.web.header.writers.frameoptions

Examples of org.springframework.security.web.header.writers.frameoptions.RegExpAllowFromStrategy


*/
public class RegExpAllowFromStrategyTests {

    @Test(expected = PatternSyntaxException.class)
    public void invalidRegularExpressionShouldLeadToException() {
        new RegExpAllowFromStrategy("[a-z");
    }
View Full Code Here


        new RegExpAllowFromStrategy("[a-z");
    }

    @Test(expected = IllegalArgumentException.class)
    public void nullRegularExpressionShouldLeadToException() {
        new RegExpAllowFromStrategy(null);
    }
View Full Code Here

        new RegExpAllowFromStrategy(null);
    }

    @Test
    public void subdomainMatchingRegularExpression() {
        RegExpAllowFromStrategy strategy = new RegExpAllowFromStrategy("^http://([a-z0-9]*?\\.)test\\.com");
        strategy.setAllowFromParameterName("from");
        MockHttpServletRequest request = new MockHttpServletRequest();

        request.setParameter("from", "http://abc.test.com");
        String result1 = strategy.getAllowFromValue(request);
        assertThat(result1, is("http://abc.test.com"));

        request.setParameter("from", "http://foo.test.com");
        String result2 = strategy.getAllowFromValue(request);
        assertThat(result2, is("http://foo.test.com"));

        request.setParameter("from", "http://test.foobar.com");
        String result3 = strategy.getAllowFromValue(request);
        assertThat(result3, is("DENY"));
    }
View Full Code Here

        assertThat(result3, is("DENY"));
    }

    @Test
    public void noParameterShouldDeny() {
        RegExpAllowFromStrategy strategy = new RegExpAllowFromStrategy("^http://([a-z0-9]*?\\.)test\\.com");
        MockHttpServletRequest request = new MockHttpServletRequest();
        String result1 = strategy.getAllowFromValue(request);
        assertThat(result1, is("DENY"));
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.header.writers.frameoptions.RegExpAllowFromStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.