spring security 自定义 AccessDecisionVoter类 ConfigAttribute.getAttribute()一直是null
现在做的ssm项目中,验证用的是security,第一次用这个,在自定义AccessDecisionVoter类时,
package jp.go.kokusen.pionet.common.security;
import java.util.Collection;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.web.FilterInvocation;
public class CustomAccessDecisionVoter implements AccessDecisionVoter<Object> {
@Override
public boolean supports(ConfigAttribute attribute) {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean supports(Class<?> clazz) {
// TODO Auto-generated method stub
return true;
}
@Override
public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) {
for (ConfigAttribute attribute : attributes) {
if(attribute.getAttribute() == null){
continue;
}
if (this.supports(attribute)) {
}
}
return result;
}
}
attribute.getAttribute() 这个方法的返回值一直是空的?
这个地方是做什么用的