SEC-2357: Move *RequestMatchers to .matchers package
This commit is contained in:
@@ -7,7 +7,7 @@ import org.junit.Test;
|
||||
import org.springframework.security.access.ConfigAttribute;
|
||||
import org.springframework.security.access.SecurityConfig;
|
||||
import org.springframework.security.web.FilterInvocation;
|
||||
import org.springframework.security.web.util.AnyRequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.AnyRequestMatcher;
|
||||
import org.springframework.security.web.util.RequestMatcher;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -22,7 +22,7 @@ public class ExpressionBasedFilterInvocationSecurityMetadataSourceTests {
|
||||
public void expectedAttributeIsReturned() {
|
||||
final String expression = "hasRole('X')";
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
requestMap.put(new AnyRequestMatcher(), SecurityConfig.createList(expression));
|
||||
requestMap.put(AnyRequestMatcher.INSTANCE, SecurityConfig.createList(expression));
|
||||
ExpressionBasedFilterInvocationSecurityMetadataSource mds =
|
||||
new ExpressionBasedFilterInvocationSecurityMetadataSource(requestMap, new DefaultWebSecurityExpressionHandler());
|
||||
assertEquals(1, mds.getAllConfigAttributes().size());
|
||||
@@ -37,7 +37,7 @@ public class ExpressionBasedFilterInvocationSecurityMetadataSourceTests {
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void invalidExpressionIsRejected() throws Exception {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();
|
||||
requestMap.put(new AnyRequestMatcher(), SecurityConfig.createList("hasRole('X'"));
|
||||
requestMap.put(AnyRequestMatcher.INSTANCE, SecurityConfig.createList("hasRole('X'"));
|
||||
ExpressionBasedFilterInvocationSecurityMetadataSource mds =
|
||||
new ExpressionBasedFilterInvocationSecurityMetadataSource(requestMap, new DefaultWebSecurityExpressionHandler());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.security.access.ConfigAttribute;
|
||||
import org.springframework.security.access.SecurityConfig;
|
||||
import org.springframework.security.web.FilterInvocation;
|
||||
import org.springframework.security.web.util.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.RequestMatcher;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.security.web.header.writers.HstsHeaderWriter;
|
||||
import org.springframework.security.web.util.AnyRequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.AnyRequestMatcher;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
@@ -46,7 +46,7 @@ public class HstsHeaderWriterTests {
|
||||
@Test
|
||||
public void allArgsCustomConstructorWriteHeaders() {
|
||||
request.setSecure(false);
|
||||
writer = new HstsHeaderWriter(new AnyRequestMatcher(), 15768000, false);
|
||||
writer = new HstsHeaderWriter(AnyRequestMatcher.INSTANCE, 15768000, false);
|
||||
|
||||
writer.writeHeaders(request, response);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class HstsHeaderWriterTests {
|
||||
@Test
|
||||
public void maxAgeAndIncludeSubdomainsCustomConstructorWriteHeaders() {
|
||||
request.setSecure(false);
|
||||
writer = new HstsHeaderWriter(new AnyRequestMatcher(), 15768000, false);
|
||||
writer = new HstsHeaderWriter(AnyRequestMatcher.INSTANCE, 15768000, false);
|
||||
|
||||
writer.writeHeaders(request, response);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class HstsHeaderWriterTests {
|
||||
|
||||
@Test
|
||||
public void writeHeadersAnyRequestMatcher() {
|
||||
writer.setRequestMatcher(new AnyRequestMatcher());
|
||||
writer.setRequestMatcher(AnyRequestMatcher.INSTANCE);
|
||||
request.setSecure(false);
|
||||
|
||||
writer.writeHeaders(request, response);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -28,6 +28,8 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.security.web.util.RequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.AndRequestMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -10,7 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -25,6 +25,8 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.AnyRequestMatcher;
|
||||
|
||||
/**
|
||||
* @author Luke Taylor
|
||||
@@ -139,7 +141,7 @@ public class AntPathRequestMatcherTests {
|
||||
assertEquals(new AntPathRequestMatcher("/xyz", "POST"), new AntPathRequestMatcher("/xyz", "POST"));
|
||||
assertFalse(new AntPathRequestMatcher("/xyz", "POST").equals(new AntPathRequestMatcher("/xyz", "GET")));
|
||||
assertFalse(new AntPathRequestMatcher("/xyz").equals(new AntPathRequestMatcher("/xxx")));
|
||||
assertFalse(new AntPathRequestMatcher("/xyz").equals(new AnyRequestMatcher()));
|
||||
assertFalse(new AntPathRequestMatcher("/xyz").equals(AnyRequestMatcher.INSTANCE));
|
||||
assertFalse(new AntPathRequestMatcher("/xyz","GET", false).equals(new AntPathRequestMatcher("/xyz","GET", true)));
|
||||
}
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.ELRequestMatcher;
|
||||
|
||||
/**
|
||||
* @author Mike Wiesner
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -6,6 +6,7 @@ import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.IpAddressMatcher;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.MediaTypeRequestMatcher;
|
||||
import org.springframework.web.accept.ContentNegotiationStrategy;
|
||||
import org.springframework.web.accept.HeaderContentNegotiationStrategy;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
@@ -30,6 +30,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.MediaTypeRequestMatcher;
|
||||
import org.springframework.web.HttpMediaTypeNotAcceptableException;
|
||||
import org.springframework.web.accept.ContentNegotiationStrategy;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
@@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -24,6 +24,8 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.security.web.util.RequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.NegatedRequestMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -28,6 +28,8 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.security.web.util.RequestMatcher;
|
||||
import org.springframework.security.web.util.matchers.OrRequestMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -10,7 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.RegexRequestMatcher;
|
||||
|
||||
/**
|
||||
* @author Luke Taylor
|
||||
@@ -13,13 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.web.util;
|
||||
package org.springframework.security.web.util.matchers;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.security.web.util.matchers.RequestHeaderRequestMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
Reference in New Issue
Block a user