Obtaining handle to Collection/Array object in @PreFilter and @PostFilter in Spring Security -


in spring security, @prefilter , @postfilter can used trim/prune argument/return object , filterobject references each element in object , used loop through argument/return collection/array.

however, need handle actual collection/array whole , not specific elements in context. there way this?

the reason creating externalized authorization service used spring security query , prune collection/array , service supports querying multiple answers in single question. once reference object whole, can iterate though elements myself create request externalized service.

can done in spring security? implementing custom express handler.

assuming return value modifiable, can use @postauthorize. example:

@postauthorize("@mysecurityfilter.filter(authentication, returnobject)") list<string> findallmessages(); 

this assumes created bean name of "mysecurityfilter" looks this:

@component public class mysecurityfilter {      public boolean filter(authentication authentication, list<string> domain) {         // submit service , allowed values         list<string> allowed = arrays.aslist("hello");          iterator<string> ivalues = domain.iterator();         while(ivalues.hasnext()) {             string value = ivalues.next();             if(!allowed.contains(value)) {                 ivalues.remove();             }         }          return true;     } } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -