WebSecurityConfig.java 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //package com.ydtech.config;
  2. //
  3. //import com.ydtech.security.JwtAuthenticationFilter;
  4. //import com.ydtech.security.JwtAuthenticationProvider;
  5. //import com.ydtech.security.UserDetailsServiceImpl;
  6. //import org.springframework.beans.factory.annotation.Autowired;
  7. //import org.springframework.beans.factory.annotation.Value;
  8. //import org.springframework.context.annotation.Bean;
  9. //import org.springframework.context.annotation.Configuration;
  10. //import org.springframework.security.authentication.AuthenticationManager;
  11. //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  12. //import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
  13. //import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  14. //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  15. //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  16. //import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
  17. //import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler;
  18. //
  19. //@Configuration
  20. //@EnableWebSecurity
  21. //@EnableGlobalMethodSecurity(prePostEnabled = true)
  22. //public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  23. //
  24. // @Autowired
  25. // private UserDetailsServiceImpl userDetailsService;
  26. //
  27. // @Autowired
  28. // private MasterPasswordConfig masterPasswordConfig;
  29. //
  30. // @Value("${upload.file.url}")
  31. // private String uploadFileUrl;
  32. //
  33. // @Override
  34. // public void configure(AuthenticationManagerBuilder auth) throws Exception {
  35. // // 使用自定义登录身份认证组件
  36. // auth.authenticationProvider(new JwtAuthenticationProvider(userDetailsService, masterPasswordConfig));
  37. // }
  38. //
  39. // @Override
  40. // protected void configure(HttpSecurity http) throws Exception {
  41. // // 禁用 csrf, 由于使用的是JWT,我们这里不需要csrf
  42. // http.cors().and().csrf().disable()
  43. // .authorizeRequests()
  44. // // 跨域预检请求
  45. //// .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
  46. // // web jars
  47. // .antMatchers("/webjars/**").permitAll()
  48. // // 查看SQL监控(druid)
  49. // .antMatchers("/druid/**").permitAll()
  50. // // 首页和登录页面
  51. // .antMatchers("/").permitAll()
  52. // .antMatchers("/login").permitAll()
  53. // .antMatchers("/sendMsg").permitAll()
  54. // .antMatchers("/loginByPhone").permitAll()
  55. // .antMatchers("/user/findById").permitAll()
  56. // .antMatchers("/esmUserInternalcheck/userRegist").permitAll()
  57. // .antMatchers("/insOrder/queryOrder").permitAll()
  58. // .antMatchers("/insOrder/getPayCode").permitAll()
  59. // .antMatchers("/zm/Underwriting").permitAll()//自动核保回调
  60. // .antMatchers("/zm/ArtificialUnderwriting").permitAll()//人工核保回调
  61. // .antMatchers("/esmUserInternalcheck/updateName").permitAll()
  62. // // swagger
  63. // .antMatchers("/doc.html").permitAll()
  64. // .antMatchers("/swagger**/**").permitAll()
  65. // .antMatchers("/webjars/**").permitAll()
  66. // .antMatchers("/v2/**").permitAll()
  67. //// .antMatchers("/swagger-ui.html").permitAll()
  68. //// .antMatchers("/swagger-resources").permitAll()
  69. //// .antMatchers("/v2/api-docs").permitAll()
  70. //// .antMatchers("/webjars/springfox-swagger-ui/**").permitAll()
  71. // // 字典
  72. // .antMatchers("/dict/**").permitAll()
  73. // //静态资源
  74. // .antMatchers("/static/**").permitAll()
  75. // //api
  76. // .antMatchers("/api/**").permitAll()
  77. // //app
  78. // .antMatchers("/app/android/**").permitAll()
  79. // // 文件上传访问路径
  80. // .antMatchers(uploadFileUrl + "**").permitAll()
  81. // // 验证码
  82. // .antMatchers("/captcha.jpg**").permitAll()
  83. // // 服务监控
  84. // .antMatchers("/actuator/**").permitAll()
  85. // .antMatchers("/API/insCBIT/**").permitAll()
  86. // .antMatchers("/CBIT/API/insCBIT/**").permitAll()
  87. // .antMatchers("/CBITAPI/insCBIT/**").permitAll()
  88. // .antMatchers("/api/yongan/**").permitAll()
  89. // .antMatchers("/order/yongAn/**").permitAll()
  90. // .antMatchers("/api/insRenbao/**").permitAll()
  91. // .antMatchers("/ins/**").permitAll()
  92. // .antMatchers("/wechat/**").permitAll()
  93. // .antMatchers("/esm/policy/**").permitAll()
  94. // // 中煤回调
  95. // .antMatchers("/order/zhongMeiApi/underwritingCallback").permitAll()
  96. // .antMatchers("/order/zhongMeiApi/auditCallback").permitAll()
  97. //
  98. // //审核退回
  99. // .antMatchers("/api/inv/invoiceInfo/approvalBack").hasAuthority("inv:invoice:info:approval:back")
  100. // //审核通过
  101. // .antMatchers("/api/inv/invoiceInfo/approvalPass").hasAuthority("inv:invoice:info:approval:pass")
  102. // // 其他所有请求需要身份认证
  103. // .anyRequest().authenticated();
  104. // // 退出登录处理器
  105. // http.logout().logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
  106. // // 开启登录认证流程过滤器
  107. //// http.addFilterBefore(new JwtLoginFilter(authenticationManager()), UsernamePasswordAuthenticationFilter.class);
  108. // // 访问控制时登录状态检查过滤器
  109. // http.addFilterBefore(new JwtAuthenticationFilter(authenticationManager()), UsernamePasswordAuthenticationFilter.class);
  110. // }
  111. //
  112. //
  113. //
  114. // @Bean
  115. // @Override
  116. // public AuthenticationManager authenticationManager() throws Exception {
  117. // return super.authenticationManager();
  118. // }
  119. //
  120. //}