【问题标题】:is graphiQL supports spring security ? graphiQL UI is not working after adding spring securitygraphiQL 是否支持弹簧安全性?添加弹簧安全性后,graphiQL UI 无法正常工作
【发布时间】:2020-06-30 19:40:05
【问题描述】:

JS CSS files are not loading

我尝试了下面的代码来允许 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

【问题讨论】:

    标签: spring spring-boot graphql spring-security-oauth2 graphiql


    【解决方案1】:

    我使用了下一个匹配器来允许渲染 graphiQl

    .antMatchers("/graphiql", "/vendor/**").permitAll()
    

    GraphiQL 版本为 5.0.2

    【讨论】:

    • 用什么方法?在web.ignoring()http.authorizeRequests()
    • http.authorizeRequests()
    猜你喜欢
    • 2023-01-03
    • 2012-01-07
    • 2017-05-08
    • 2016-06-19
    • 2018-09-28
    • 2018-09-08
    • 1970-01-01
    • 2016-10-14
    • 2019-02-03
    相关资源
    最近更新 更多