use of org.springframework.security.web.header.writers.frameoptions.WhiteListedAllowFromStrategy in project spring-security by spring-projects.
the class WhiteListedAllowFromStrategyTests method requestWithoutParameterShouldNotMatch.
@Test
public void requestWithoutParameterShouldNotMatch() {
List<String> allowed = new ArrayList<String>();
allowed.add("http://www.test.com");
WhiteListedAllowFromStrategy strategy = new WhiteListedAllowFromStrategy(allowed);
strategy.setAllowFromParameterName("from");
MockHttpServletRequest request = new MockHttpServletRequest();
String result = strategy.getAllowFromValue(request);
assertThat(result).isEqualTo("DENY");
}
use of org.springframework.security.web.header.writers.frameoptions.WhiteListedAllowFromStrategy in project spring-security by spring-projects.
the class WhiteListedAllowFromStrategyTests method listWithMultipleElementShouldMatch.
@Test
public void listWithMultipleElementShouldMatch() {
List<String> allowed = new ArrayList<String>();
allowed.add("http://www.test.com");
allowed.add("http://www.springsource.org");
WhiteListedAllowFromStrategy strategy = new WhiteListedAllowFromStrategy(allowed);
strategy.setAllowFromParameterName("from");
MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("from", "http://www.test.com");
String result = strategy.getAllowFromValue(request);
assertThat(result).isEqualTo("http://www.test.com");
}
use of org.springframework.security.web.header.writers.frameoptions.WhiteListedAllowFromStrategy in project spring-security by spring-projects.
the class WhiteListedAllowFromStrategyTests method listWithSingleElementShouldMatch.
@Test
public void listWithSingleElementShouldMatch() {
List<String> allowed = new ArrayList<String>();
allowed.add("http://www.test.com");
WhiteListedAllowFromStrategy strategy = new WhiteListedAllowFromStrategy(allowed);
strategy.setAllowFromParameterName("from");
MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("from", "http://www.test.com");
String result = strategy.getAllowFromValue(request);
assertThat(result).isEqualTo("http://www.test.com");
}
use of org.springframework.security.web.header.writers.frameoptions.WhiteListedAllowFromStrategy in project spring-security by spring-projects.
the class WhiteListedAllowFromStrategyTests method listWithSingleElementShouldNotMatch.
@Test
public void listWithSingleElementShouldNotMatch() {
List<String> allowed = new ArrayList<String>();
allowed.add("http://www.test.com");
WhiteListedAllowFromStrategy strategy = new WhiteListedAllowFromStrategy(allowed);
strategy.setAllowFromParameterName("from");
MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter("from", "http://www.test123.com");
String result = strategy.getAllowFromValue(request);
assertThat(result).isEqualTo("DENY");
}
Aggregations