Home > Back-end >  Spring security custom AccessDecisionVoter class ConfigAttribute. The getAttribute () is always null
Spring security custom AccessDecisionVoter class ConfigAttribute. The getAttribute () is always null

Time:10-29

Now do the SSM project, verify with the security, use this for the first time, in the custom AccessDecisionVoter class,

Package jp.go.kokusen.pionet.com mon. Security;

Import the Java. Util. Collection;

The import org. Springframework. Security. Access. AccessDecisionVoter;
The import org. Springframework. Security. Access. ConfigAttribute;
The import org. Springframework. Security. Core. The Authentication;
The import org. Springframework. Security. Core. GrantedAuthority;
The import org. Springframework. Security. Web. FilterInvocation;

Public class CustomAccessDecisionVoter implements AccessDecisionVoter {

@ 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, the Object Object, Collection The attributes) {

For (ConfigAttribute attribute: the attributes) {

If (attribute. The getAttribute ()==null) {
continue;
}

If (this. Supports (attribute)) {

}
}

return result;
}

}


Attribute. The getAttribute (), the return value of this method have been empty?
What this place is for

  • Related