I'm trying to configure security exceptions to all JavaScript/CSS of my pages.
I need to login to access the JSP files, except the login
page, but all pages needs your resources so the folders must be access-free.
.csrf().disable()
.authorizeRequests()
.antMatchers("/login*").anonymous()
.antMatchers("/bower_components/**").permitAll()
.antMatchers("/custom/**").permitAll()
.antMatchers("/plugins/**").permitAll()
.antMatchers("/dist/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/loginPage")
.defaultSuccessUrl("/home", true)
.failureUrl("/loginPage?error=true")
.loginProcessingUrl("/login")
.usernameParameter("username")
.passwordParameter("password")
.and()
.logout()
.logoutSuccessUrl("/loginPage")
.invalidateHttpSession(true);
the code seems ugly
part of original question. I need to know if the code in question is as elegant as possible and without the original text the users may not know what I mean. Someone may flag asobscure
... \$\endgroup\$