Search code examples
javascriptspringspring-securityweblogicweblogic11g

Spring Security weblogic js loading


I have web app with Spring security.

When I run my app on tomcat9 all works fine, but when I use oracle Weblogic something goes wrong and my js scripts in app doesnt work.

Refused to execute script from 'http://localhost:7001/ais/s/lib/datetime/js/moment-with-locales.min.js' because its MIME type ('application/octet-stream') is not executable, and strict MIME type checking is enabled.

this is my security config:

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    UserService service;


    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .authorizeRequests()
            .antMatchers("/s/**").permitAll() 
            .anyRequest().authenticated()
            .and()
        .formLogin()
            .loginPage("/login")
            .permitAll()
            .and()
        .logout()
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .permitAll();
    }




    @Override
    protected void configure(AuthenticationManagerBuilder auth)
            throws Exception {
        auth
        .userDetailsService(new UserDetailServiceImpl(service));
    }
}

Solution

  • I just solve it by putting to SecurityConfig this

    @Override
    public void configure(WebSecurity web) throws Exception {
      web.ignoring().antMatchers("/s/**");
    }