Giter Site home page Giter Site logo

messaging-sample's Introduction

messaging-sample

messaging-sample's People

Contributors

jgrandja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

messaging-sample's Issues

web.ignoring() static assets

Hi,

I am in the process of learning about Spring Security and have been playing with this project after seeing your presentation on YouTube. I have a query about cutting down the processing of static assets.

I have seen in another blog post that in a WebSecurityConfigurerAdapter class you can override the configure method like this:

@Override
public void configure(WebSecurity web) {
    web.ignoring().mvcMatchers(...);
}

Doing this (I believe) means you can skip the whole filter chain process for specified paths. Am I correct in thinking this would be more efficient?

If so I have had a couple of issues implementing this. I created a new WebSecurityConfigurerAdapter and specified it as the first one to be processed:

@Configuration
@Order(1)
public static class SkipSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    public void configure(WebSecurity web) {
        web.ignoring().mvcMatchers("/assets/**", "/webjars/**");
    }
}

I also removed the .antMatchers("/assets/**", "/webjars/**").permitAll() lines from both other WebSecurityConfigurerAdapter classes (leaving in .antMatchers("/").permitAll() in AppSecurityConfig).

This succeeds in clearing the filter chain if I go to specific resources directly like http://localhost:8080/assets/img/logo.png but breaks the other WebSecurityConfigurerAdapter classes as they no longer seem to be picked up.

Is this a valid thing to be doing and if so how should it be implemented to ensure the 2 existing filter chains work as expected?

Thanks,

David.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.