我尝试了下面的代码来允许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
答案 0 :(得分:1)
我使用了下一个匹配器来渲染graphiQl
.antMatchers("/graphiql", "/vendor/**").permitAll()
GraphiQL版本为5.0.2