加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

spring security自定义授权(accessDecisionManager)

(2014-07-23 14:56:54)
标签:

secutity

spring

role

decision

access

分类: 安全
http://s7/mw690/001mZQg1gy6KFFg4Qbs96&690security自定义授权(accessDecisionManager)" TITLE="spring security自定义授权(accessDecisionManager)" />

  • java code: DatabaseRoleVoter

 

public class DatabaseRoleVoter implements AccessDecisionVoter {
     @Override
    public boolean supports(ConfigAttribute arg0) {
        System.out.println(this.getClass().getName()
                + ".supports(ConfigAttribute arg0)");
        return true;
    }

    @Override
    public boolean supports(Class arg0) {
        System.out.println(this.getClass().getName() + ".supports(Class arg0)");
        return true;
    }

    @Override
    public int vote(Authentication au, Object arg1, Collection arg2) {
        int result = 0;
        String name = au.getName();
        if (name.equalsIgnoreCase("Rod")) {
            result = 1;
        } else {
            result = -1;
        }
        System.out.println(this.getClass().getName() + ".vote");
        System.out.println(arg1);
        System.out.println(arg2);
        return result;
    }
}

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有