Examples of NegatedRequestMatcher


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

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

    private RequestMatcher matcher;

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

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

    }

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

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

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

    }

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

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

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

    @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

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

    @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

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

    @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

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

    @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

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

    @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
Copyright © 2018 www.massapi.com. 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.