Spring Security Oauth2.0认证授权

15.Spring Security应用详解-工作原理-授权流程

2020-03-25  本文已影响0人  LANSHENGYANG

授权流程

授权流程

分析授权流程:
http
    .authorizeRequests()
        .antMatchers("/r/r1").hasAuthority("p1")
        .antMatchers("/r/r2").hasAuthority("p2")
        ...
public class AccessDecisionManager {
    /**
     * 通过传递的参数来决定用户是否访问对应受保护资源的权限
     * @param authentication
     * @param object
     * @param configAttributes
     */
    void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes){、
        //略..
    }
}

授权决策

public interface AccessDecisionVoter<S> {
    int ACCESS_GRANTED = 1;
    int ACCESS_ABSTAIN = 0;
    int ACCESS_DENIED = -1;

    boolean supports(ConfigAttribute attribute);
    
    boolean supports(Class<?> clazz);

    int vote(Authentication authentication, S object, Collection<ConfigAttribute> attributes);
}
上一篇下一篇

猜你喜欢

热点阅读