m building a web site using spring security, for now i m just mapping the permitted urls but the view can t render css and js. If i add the path of CSS to antmatcher, still not works. If i ignore JUST THOSE FOLDERS, spring security does not work at all (response from private urls allowed). Some advice?
-on stack, they said to work with xml, but using spring boot 3+, there is no xml configuration file. Am i right or am i missing something?
you would do mapping to permitte css and js urls, i remeber that the order of permitted and block urls matters
Like @eduardo_asafe said, order matters: first you should specify more generic rules, and all futher rules override previous. Here's how my configuration for css/js/images looks like (it's grails, based on spring boot 1.5, but it's basically the same with syntax sugar). Note that spring security filter chains are also disabled for css/js/images: grails.plugin.springsecurity.controllerAnnotations.staticRules = [ [pattern: '/**', access: ['ROLE_USER']], // by default only users can access, subsequent rules override this ..... more specific patterns ..... [pattern: '/error', access: ['permitAll']], [pattern: '/assets/**', access: ['permitAll']], [pattern: '/**/js/**', access: ['permitAll']], [pattern: '/**/css/**', access: ['permitAll']], [pattern: '/**/images/**', access: ['permitAll']], [pattern: '/**/favicon.ico', access: ['permitAll']] ] grails.plugin.springsecurity.filterChain.chainMap = [ [pattern: '/assets/**', filters: 'none'], [pattern: '/**/js/**', filters: 'none'], [pattern: '/**/css/**', filters: 'none'], [pattern: '/**/images/**', filters: 'none'], [pattern: '/**/favicon.ico', filters: 'none'], [pattern: '/**', filters: 'JOINED_FILTERS'] ]
I guess, you're talking about spring boot 2+. I haven't worked with version 2, but official documentation says: https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#using-boot-importing-xml-configuration
Обсуждают сегодня