스프링 보안에 대한 내 자신의 PermissionEvaluator를 작성 중이며, 내가하려고하는 일 중 하나는 보호하고있는 메소드의 이름을 파악하는 것입니다.사전/사후 권한 부여 메소드 이름 얻기
예를 들어, 그림에서 메소드 이름없이 내가 좋아하는 뭔가가 있습니다
postAuthorize("hasPermission(returnObject,'read')")
Event getEvent(int evendId) {
...
}
및
public boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission) {
if(targetDomainObject instanceof Event) {
return hasPermission(authentication, targetDomainObject, permission);
}
return targetDomainObject == null;
}
을하지만 또한 메소드 이름 "getEvent"는 hasPermission 사용할 수 있어야합니다. 다음과 같이 수동으로 hasPermission 호출을 전달하여이 작업을 수행 할 수 있습니다.
@PostAuthorize("hasPermission(new com.example.AuthZObject(returnObject,'getEvent'),'read')")
Event getEvent(int eventId);
더 많은 자동화 된 방법이 있습니까?
감사 랄프, 내가 뭔가를하는 과정에서 오전하지만, [히트]있다 (http://stackoverflow.com/questions/23237117/creating-custom-postauthorize-method-in-spring-security) 문제에 대한 또 다른 벽 –