【发布时间】:2018-03-24 03:46:53
【问题描述】:
我有一个带有 Spring 安全性的网络应用程序。
当我在 tomcat9 上运行我的应用程序时一切正常,但是当
我使用 oracle Weblogic 出了点问题,我在应用程序中的 js 脚本不起作用。
拒绝执行来自“http://localhost:7001/ais/s/lib/datetime/js/moment-with-locales.min.js”的脚本,因为它的 MIME 类型 ('application/octet-stream') 不可执行,并且启用了严格的 MIME 类型检查。
这是我的安全配置:
@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));
}
}
【问题讨论】:
-
我相信对于 weblogic,你需要一些额外的配置。你的项目中有
WEB-INF文件夹吗? -
@AtaurRahmanMunna 是的,我的 /s/ 文件夹带有 js css,/views/
-
和 xml:dispatcher-servlet、web、weblogic、jdbc、tiles
标签: javascript spring spring-security weblogic weblogic11g