src112159 最近的时间轴更新
src112159

src112159

V2EX 第 280322 号会员,加入于 2018-01-06 13:53:15 +08:00
src112159 最近回复了
2020-02-29 01:37:21 +08:00
回复了 lik750 创建的主题 问与答 百度云同步盘突然清空了我电脑上文件夹内所有本地文件!
似乎没人说谷歌硬盘。
2020-02-21 00:38:07 +08:00
回复了 seanxx 创建的主题 MacBook Pro macbookpro 出现爆裂噼里啪啦声音
排除法看看
2019-04-04 10:05:24 +08:00
回复了 cjzlol 创建的主题 生活 耳鸣一个多月了,好烦
是身体太虚引起的,我有过这样的经历,去医院检查也没啥毛病。大部分原因是心理压力和营养不够造成的
2018-12-26 18:46:06 +08:00
回复了 alwayshere 创建的主题 程序员 刚从 win 换到 mac, mac 下有没有类似于 xshell 的工具?
个人感觉比 MAC 版的 SecureCRT 好用
2018-12-26 18:44:18 +08:00
回复了 alwayshere 创建的主题 程序员 刚从 win 换到 mac, mac 下有没有类似于 xshell 的工具?
ZOC7,我现在在用的,推荐试试
2018-12-26 18:42:02 +08:00
回复了 heraldic 创建的主题 Linux deepin Linux 确实好用,暂时整机就用它了
PC 装个黑苹果其实还不错,远景上有很多别人做好的引导
就是因为那个返回的 code 的原因,返回 1001 前段直接 logout 了。。。。
@beny2mor

已经找到问题了,谢谢你的帮助哈,。
@beny2mor
@Service
public class MyAccessDecisionManager implements AccessDecisionManager {


@Override
public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
if(null == configAttributes || configAttributes.size() <= 0) {
return;
}
ConfigAttribute c;
String needRole;
for(Iterator<ConfigAttribute> iter = configAttributes.iterator(); iter.hasNext(); ) {
c = iter.next();
needRole = c.getAttribute();
for(GrantedAuthority ga : authentication.getAuthorities()) {
if(needRole.trim().equals(ga.getAuthority())) {
return;
}
}
}
throw new AccessDeniedException("没有操作权限");
}

@Override
public boolean supports(ConfigAttribute attribute) {
return true;
}

@Override
public boolean supports(Class<?> clazz) {
return true;
}
}


----------------------------------------------------------------


@Component
public class MyAccessDeniedHandler implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws IOException, ServletException {
//返回 json 形式的错误信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.getWriter().println("{\"code\":1001, \"msg\":\""+e.getMessage()+"\"}");
response.getWriter().flush();
}
}


----------------------------------------------------------
是有 AccessDecisionManager 的,无权限的资源也返回了这个 json,现在就是会自己跳转到登录
@beny2mor 这样权限控制好像是没有问题的,但就是会跳转到自定义的登录页面
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1711 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 16:41 · PVG 00:41 · LAX 09:41 · JFK 12:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.