@Override | @Override | ||||
protected void addCorsMappings(CorsRegistry registry) { | protected void addCorsMappings(CorsRegistry registry) { | ||||
registry.addMapping("/**") | registry.addMapping("/**") | ||||
.allowedOrigins("*") | |||||
//SpringBoot升级2.4.0之后,跨域配置中的.allowedOrigins不再可用 | |||||
// .allowedOrigins("*") | |||||
.allowedOriginPatterns("*") | |||||
.allowCredentials(true) | .allowCredentials(true) | ||||
.allowedMethods(ORIGINS) | .allowedMethods(ORIGINS) | ||||
.maxAge(3600); | .maxAge(3600); |
filterChainDefinitionMap.put("/dronecode/generate", "anon"); | filterChainDefinitionMap.put("/dronecode/generate", "anon"); | ||||
//文件上传 | //文件上传 | ||||
filterChainDefinitionMap.put("/oss/uploadFile", "anon"); | filterChainDefinitionMap.put("/oss/uploadFile", "anon"); | ||||
filterChainDefinitionMap.put("/health/**", "anon"); | |||||
// 所有url都必须认证通过才可以访问 | // 所有url都必须认证通过才可以访问 | ||||
filterChainDefinitionMap.put("/**", "authc"); | filterChainDefinitionMap.put("/**", "authc"); | ||||