0

I have a webSecConfig class that extends WebSecurityConfigurerAdapter. I paste it's method where I tried to allow access with using .antMatchers. My folder structure: ... -resources --static (here I have images for the html/css) --templates ---login.html ---design.css I have tried adding a "public" folder based on some comments, but nothing seems to work so far. Can anyone help me with this please?

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .formLogin()
            .loginPage("/login").permitAll()
            .loginProcessingUrl("/login")
            .defaultSuccessUrl("/messages", true)
            .and()
            .logout()
            .logoutSuccessUrl("/login")
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET"))
            .and()
            .authorizeRequests()
            .antMatchers("/login", "resources/**").permitAll()
            .anyRequest().authenticated();
}

1 Answer 1

0

I managed to solve it! I put my css's in a css folder inside resources/static. And I used "/css/**" in the antMatchers section. Also href to the css should be: href="/css/design.css", my IDE has refactored it as href="../static/css/design.css" wich is WRONG, so look out for this! I hope it will help someone!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.