解决静态路径问题
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ruoyi.common.enums;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,28 +10,23 @@ import org.springframework.lang.Nullable;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public enum HttpMethod
|
public enum HttpMethod {
|
||||||
{
|
|
||||||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
||||||
|
|
||||||
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
||||||
|
|
||||||
static
|
static {
|
||||||
{
|
for (HttpMethod httpMethod : values()) {
|
||||||
for (HttpMethod httpMethod : values())
|
|
||||||
{
|
|
||||||
mappings.put(httpMethod.name(), httpMethod);
|
mappings.put(httpMethod.name(), httpMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static HttpMethod resolve(@Nullable String method)
|
public static HttpMethod resolve(@Nullable String method) {
|
||||||
{
|
|
||||||
return (method != null ? mappings.get(method) : null);
|
return (method != null ? mappings.get(method) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(String method)
|
public boolean matches(String method) {
|
||||||
{
|
|
||||||
return (this == resolve(method));
|
return (this == resolve(method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||||||
// 过滤请求
|
// 过滤请求
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||||
.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
.antMatchers("/login", "/register", "/captchaImage","/home/**").permitAll()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
|
|||||||
Reference in New Issue
Block a user