use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class StaticResourceRequestTests method atLocationWhenHasServletPathShouldMatchLocation.
@Test
void atLocationWhenHasServletPathShouldMatchLocation() {
RequestMatcher matcher = this.resourceRequest.at(StaticResourceLocation.CSS);
assertMatcher(matcher, null, "/foo").matches("/foo", "/css/file.css");
assertMatcher(matcher, null, "/foo").doesNotMatch("/foo", "/js/file.js");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class StaticResourceRequestTests method atCommonLocationsShouldMatchCommonLocations.
@Test
void atCommonLocationsShouldMatchCommonLocations() {
RequestMatcher matcher = this.resourceRequest.atCommonLocations();
assertMatcher(matcher).matches("/css/file.css");
assertMatcher(matcher).matches("/js/file.js");
assertMatcher(matcher).matches("/images/file.css");
assertMatcher(matcher).matches("/webjars/file.css");
assertMatcher(matcher).matches("/favicon.ico");
assertMatcher(matcher).matches("/favicon.png");
assertMatcher(matcher).matches("/icons/icon-48x48.png");
assertMatcher(matcher).doesNotMatch("/bar");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project spring-boot by spring-projects.
the class StaticResourceRequestTests method atCommonLocationsWithExcludeShouldNotMatchExcluded.
@Test
void atCommonLocationsWithExcludeShouldNotMatchExcluded() {
RequestMatcher matcher = this.resourceRequest.atCommonLocations().excluding(StaticResourceLocation.CSS);
assertMatcher(matcher).doesNotMatch("/css/file.css");
assertMatcher(matcher).matches("/js/file.js");
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project incubator-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;
}
use of org.springframework.security.web.util.matcher.RequestMatcher in project CzechIdMng by bcvsolutions.
the class WebSecurityConfig method configure.
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
//
AuthenticationFilter authenticationFilter = authenticationFilter();
Set<RequestMatcher> publicPaths = authenticationFilter.getPublicPathRequestMatchers();
//
http.addFilterBefore(requestContextFilter(), BasicAuthenticationFilter.class).addFilterBefore(startUserTransactionFilter(), BasicAuthenticationFilter.class).addFilterAfter(authenticationFilter, BasicAuthenticationFilter.class).addFilterAfter(extendExpirationFilter(), BasicAuthenticationFilter.class).authorizeRequests().expressionHandler(expressionHandler()).antMatchers(HttpMethod.OPTIONS).permitAll().requestMatchers(publicPaths.toArray(new RequestMatcher[publicPaths.size()])).permitAll().antMatchers(BaseDtoController.BASE_PATH + "/**").fullyAuthenticated().anyRequest().permitAll();
}
Aggregations