use of org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher in project spring-security by spring-projects.
the class RequestHeaderRequestMatcherTests method matchesHeaderNameDoesNotMatch.
@Test
public void matchesHeaderNameDoesNotMatch() {
request.addHeader(headerName + "notMatch", headerValue);
assertThat(new RequestHeaderRequestMatcher(headerName).matches(request)).isFalse();
}
use of org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher in project spring-security by spring-projects.
the class RequestHeaderRequestMatcherTests method matchesHeaderNameValueHeaderValueNotMatch.
@Test
public void matchesHeaderNameValueHeaderValueNotMatch() {
request.addHeader(headerName, headerValue + "notMatch");
assertThat(new RequestHeaderRequestMatcher(headerName, headerValue).matches(request)).isFalse();
}
use of org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher in project spring-security by spring-projects.
the class RequestHeaderRequestMatcherTests method matchesHeaderNameValueHeaderNameNotMatch.
@Test
public void matchesHeaderNameValueHeaderNameNotMatch() {
request.addHeader(headerName + "notMatch", headerValue);
assertThat(new RequestHeaderRequestMatcher(headerName, headerValue).matches(request)).isFalse();
}
use of org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher in project ma-core-public by infiniteautomation.
the class MangoSecurityConfiguration method createBrowserHtmlRequestMatcher.
/**
* Internal method to create a static matcher
* @return
*/
private static RequestMatcher createBrowserHtmlRequestMatcher() {
ContentNegotiationStrategy contentNegotiationStrategy = contentNegotiationStrategy();
MediaTypeRequestMatcher mediaMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.APPLICATION_XHTML_XML, MediaType.TEXT_HTML);
mediaMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
RequestMatcher notXRequestedWith = new NegatedRequestMatcher(new RequestHeaderRequestMatcher("X-Requested-With", "XMLHttpRequest"));
return new AndRequestMatcher(Arrays.asList(notXRequestedWith, mediaMatcher));
}
use of org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher in project atlas by apache.
the class AtlasSecurityConfig method getDelegatingAuthenticationEntryPoint.
public DelegatingAuthenticationEntryPoint getDelegatingAuthenticationEntryPoint() {
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPointMap = new LinkedHashMap<>();
entryPointMap.put(new RequestHeaderRequestMatcher("User-Agent", "Mozilla"), atlasAuthenticationEntryPoint);
DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(entryPointMap);
entryPoint.setDefaultEntryPoint(getAuthenticationEntryPoint());
return entryPoint;
}
Aggregations