我尝试了下面的代码来允许 js 和 css 文件
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/v2/api-docs",
"/configuration/ui",
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**",
"/graphiql",
"/resources/**"
);
}
/*@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/resources/**"); // #3
}*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/resources/**").permitAll()
.antMatchers("/*.js").permitAll()
.antMatchers("/*.css").permitAll()
.antMatchers("/*.html").permitAll()
.and().csrf().disable();
}
我觉得 Graphiql UI 有问题?有人可以帮忙吗?
供参考 GraphiQL UI 用于查询 GraphiQL UI