格式化代码

This commit is contained in:
liuchengqian 2022-06-03 18:52:59 +08:00
parent ea418a7cfa
commit 5e94f58b5d

View File

@ -14,11 +14,12 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
@EnableGlobalMethodSecurity(prePostEnabled = true)
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 设置 HTTP 验证规则
*
* @param http
* @throws Exception
*/
@ -39,52 +40,23 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// 所有 /login 用户登录 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/login").permitAll()
// 所有 app 用户注册 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll()
.antMatchers("/ws/asset").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/booleanUserName").permitAll()
.antMatchers(HttpMethod.POST,"/insertFirePoint").permitAll()
.antMatchers(HttpMethod.POST,"/insertfirepointchanneltwo").permitAll()
.antMatchers(HttpMethod.POST,"/insertAppTask").permitAll()
.antMatchers(HttpMethod.GET,"/selectAppTask").permitAll()
.antMatchers(HttpMethod.GET,"/selectFirePointBetweenSeven").permitAll()
.antMatchers(HttpMethod.GET,"/selectFirePointNum").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/booleanUserName").permitAll()
.antMatchers(HttpMethod.GET,"/websocketTest").permitAll()
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
.antMatchers(HttpMethod.GET,"/weather/cityName").permitAll()
.antMatchers(HttpMethod.GET,"/weather/cityId").permitAll()
.antMatchers(HttpMethod.GET,"/selectFirePointByCode").permitAll()
.antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll()
.antMatchers(HttpMethod.POST,"/uploadFileMore").permitAll()
.antMatchers(HttpMethod.POST,"/uploadFile").permitAll()
.antMatchers(HttpMethod.POST,"/insertFireTest").permitAll()
.antMatchers(HttpMethod.POST,"/importCityExcel").permitAll()
.antMatchers(HttpMethod.POST,"/deleteShuiTi").permitAll()
.antMatchers(HttpMethod.GET,"/selectBeijing").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/verificationCodeUpdate").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/getVerificationCode").permitAll()
.antMatchers(HttpMethod.POST,"/api/user/userUnRememberPassword").permitAll()
.antMatchers(HttpMethod.POST,"/updateBeforeFireAndAfterFireImage").permitAll()
.antMatchers(HttpMethod.GET,"/getProvinceList").permitAll()//获取省列表
.antMatchers(HttpMethod.GET,"/getCityList").permitAll()//根据省编号获取市列表
.antMatchers(HttpMethod.GET,"/getCountyList").permitAll()//根据市编号获取区县列表
.antMatchers(HttpMethod.GET,"/getStreetList").permitAll()//根据区县编号获取街道列表
.antMatchers(HttpMethod.GET,"/api/adm/getProvinceList").permitAll()//获取省列表
.antMatchers(HttpMethod.GET,"/api/adm/getCityList").permitAll()//根据省编号获取市列表
.antMatchers(HttpMethod.GET,"/api/adm/getCountyList").permitAll()//根据市编号获取区县列表
.antMatchers(HttpMethod.GET,"/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表
.antMatchers(HttpMethod.GET,"/updateFirePointStreetCode").permitAll()
.antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll().antMatchers("/ws/asset").permitAll().antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll().antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll().antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll().antMatchers(HttpMethod.POST, "/insertAppTask").permitAll().antMatchers(HttpMethod.GET, "/selectAppTask").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointBetweenSeven").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointNum").permitAll().antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll().antMatchers(HttpMethod.GET, "/websocketTest").permitAll().antMatchers(HttpMethod.GET, "/selectCityName").permitAll().antMatchers(HttpMethod.GET, "/weather/cityName").permitAll().antMatchers(HttpMethod.GET, "/weather/cityId").permitAll().antMatchers(HttpMethod.GET, "/selectFirePointByCode").permitAll().antMatchers(HttpMethod.POST, "/updateTypeByFireCode").permitAll().antMatchers(HttpMethod.GET, "/api/user/verificationCode").permitAll().antMatchers(HttpMethod.POST, "/uploadFileMore").permitAll().antMatchers(HttpMethod.POST, "/uploadFile").permitAll().antMatchers(HttpMethod.POST, "/insertFireTest").permitAll().antMatchers(HttpMethod.POST, "/importCityExcel").permitAll().antMatchers(HttpMethod.POST, "/deleteShuiTi").permitAll().antMatchers(HttpMethod.GET, "/selectBeijing").permitAll().antMatchers(HttpMethod.GET, "/api/user/verificationCodeUpdate").permitAll().antMatchers(HttpMethod.GET, "/api/user/getVerificationCode").permitAll().antMatchers(HttpMethod.POST, "/api/user/userUnRememberPassword").permitAll().antMatchers(HttpMethod.POST, "/updateBeforeFireAndAfterFireImage").permitAll().antMatchers(HttpMethod.GET, "/getProvinceList").permitAll()//获取省列表
.antMatchers(HttpMethod.GET, "/getCityList").permitAll()//根据省编号获取市列表
.antMatchers(HttpMethod.GET, "/getCountyList").permitAll()//根据市编号获取区县列表
.antMatchers(HttpMethod.GET, "/getStreetList").permitAll()//根据区县编号获取街道列表
.antMatchers(HttpMethod.GET, "/api/adm/getProvinceList").permitAll()//获取省列表
.antMatchers(HttpMethod.GET, "/api/adm/getCityList").permitAll()//根据省编号获取市列表
.antMatchers(HttpMethod.GET, "/api/adm/getCountyList").permitAll()//根据市编号获取区县列表
.antMatchers(HttpMethod.GET, "/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表
.antMatchers(HttpMethod.GET, "/updateFirePointStreetCode").permitAll()
// 所有其它请求需要身份认证
.anyRequest().authenticated()
.and()
.anyRequest().authenticated().and()
// 添加一个过滤器 所有访问 /login 的请求交给 JWTLoginFilter 来处理 这个类处理所有的JWT相关内容
.addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()),
UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()), UsernamePasswordAuthenticationFilter.class)
// 添加一个过滤器验证其他请求的Token是否合法
.addFilterBefore(new JwtAuthenticationFilter(),
UsernamePasswordAuthenticationFilter.class);
;}
.addFilterBefore(new JwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {