管理端动态权限验证
动态权限要基于Spring 提供AccessDecisionManager接口及 FilterInvocationSecurityMetadataSource接口来完成的:
AccessDecisionManager接口
void decide(Authentication authentication, Object object,
Collection<ConfigAttribute> configAttributes)
throws AccessDeniedException, InsufficientAuthenticationException
authentication是当前用户的权限
configAttributes是返问此资源需要的权限集合,由FilterInvocationSecurityMetadataSource 接口提供
FilterInvocationSecurityMetadataSource接口
Collection<ConfigAttribute> getAttributes(Object object)
根据object(当前资源)获取此资源所需要的权限集合
此权限集合我们存放在Redis中,以“ADMIN_URL_ROLE” 为key
在权限发生变更时,要更新此集合
此集合以访问,以角色名字为key,以url为value: