Package org.springframework.security.web.util.matcher

Examples of org.springframework.security.web.util.matcher.NegatedRequestMatcher


        ContentNegotiationStrategy contentNegotiationStrategy = http.getSharedObject(ContentNegotiationStrategy.class);
        if(contentNegotiationStrategy == null) {
            contentNegotiationStrategy = new HeaderContentNegotiationStrategy();
        }

        RequestMatcher notFavIcon = new NegatedRequestMatcher(new AntPathRequestMatcher("/**/favicon.ico"));

        MediaTypeRequestMatcher jsonRequest = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.APPLICATION_JSON);
        jsonRequest.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
        RequestMatcher notJson = new NegatedRequestMatcher(jsonRequest);

        RequestMatcher notXRequestedWith = new NegatedRequestMatcher(new RequestHeaderRequestMatcher("X-Requested-With","XMLHttpRequest"));

        boolean isCsrfEnabled = http.getConfigurer(CsrfConfigurer.class) != null;

        List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
        if(isCsrfEnabled) {
View Full Code Here


    private RequestMatcher matcher;

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

    }

    @Test
    public void matchesDelegateFalse() {
        when(delegate.matches(request)).thenReturn(false);
        matcher = new NegatedRequestMatcher(delegate);

        assertThat(matcher.matches(request)).isTrue();
    }
View Full Code Here

    }

    @Test
    public void matchesDelegateTrue() {
        when(delegate.matches(request)).thenReturn(true);
        matcher = new NegatedRequestMatcher(delegate);

        assertThat(matcher.matches(request)).isFalse();
    }
View Full Code Here

    @Override
    protected void configure(HttpSecurity http) throws Exception {
      // @formatter:off 
      http.addFilterBefore(resourceFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**")))
        .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler())
      .and()
        .anonymous().disable()
        .csrf().disable()
        .exceptionHandling()
View Full Code Here

    @Override
    protected void configure(HttpSecurity http) throws Exception {
      // @formatter:off 
      http.addFilterBefore(resourceFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**")))
        .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler())
      .and()
        .anonymous().disable()
        .csrf().disable()
        .exceptionHandling()
View Full Code Here

    @Override
    public void configure(HttpSecurity http) throws Exception {
      // @formatter:off 
      http.addFilterBefore(resourceFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**")))
        .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler())
      .and()
        .anonymous().disable()
        .csrf().disable()
        .exceptionHandling()
View Full Code Here

    @Override
    protected void configure(HttpSecurity http) throws Exception {
      // @formatter:off 
      http.addFilterBefore(resourceFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**")))
        .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler())
      .and()
        .anonymous().disable()
        .csrf().disable()
        .exceptionHandling()
View Full Code Here

    @Override
    protected void configure(HttpSecurity http) throws Exception {
      // @formatter:off 
      http.addFilterBefore(resourceFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**")))
        .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler())
      .and()
        .anonymous().disable()
        .csrf().disable()
        .exceptionHandling()
View Full Code Here

TOP

Related Classes of org.springframework.security.web.util.matcher.NegatedRequestMatcher

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.