lenve / vhr

微人事是一个前后端分离的人力资源管理系统,项目采用SpringBoot+Vue开发。
http://vhr.javaboy.org
27.19k stars 10.29k forks source link

资源访问控制问题 #87

Open Mrssqin opened 5 years ago

Mrssqin commented 5 years ago

我想实现注册的功能, 然后把数据post到后端 ,但是绕不过spring secuirty的安全认证

下面是我对websecurity更改的代码 ` @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/index.html", "/static/*", "/login_p", "/favicon.ico","/register/"); }

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/register/addClient").permitAll()`

同时我也对 CustomMetadataSource 中的代码进行了更改 if(requestUrl.equals("/register/addClient")){ return null; } 但是结果还是会被拦截要求登陆 实在是蒙蔽了 求大神指点一哈

Mrssqin commented 5 years ago

补充一下 我在CustomMetadataSource 中对于 requestUrl 进行了log 发现它的地址是 \error

lenve commented 5 years ago

你的思路是ok的,配置地址忽略即可,修改完成后,先用postman等工具测试下接口