MyAccessDecisionManager.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:Shop 作者:
@Override
public void decide(Authentication authentication, Object object,Collection<ConfigAttribute> configAttributes)

        throws AccessDeniedException, InsufficientAuthenticationException {

    if(configAttributes == null){
        return  ;
    }
    Iterator<ConfigAttribute> ite = configAttributes.iterator();
    while(ite.hasNext()){

        ConfigAttribute ca = ite.next();

        String needRole = ((SecurityConfig)ca).getAttribute();

        for(GrantedAuthority grantedAuthority : authentication.getAuthorities()){
            if(needRole.trim().equals(grantedAuthority.getAuthority().trim())){
                return;
            }
        }
    }
    //û��Ȩ�޷���
    throw new AccessDeniedException("û��Ȩ�޷��ʣ�");

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号