Hello,
   I am refactoring some code and have come across an interesting issue. On
refactoring has pointed to a nice solution using a generic interface...

So lets say I had something really dumbed down like:

@RequiresRoles(A)
public Client updateClient(Client)

@RequiresRoles(B)
public Staff updateStaff(Staff)

but now I have

@ ??
public T update(T)

The saving in my codebase is quite substantial - lots of duplicated code
removed - smaller footprint, less coverage etc...

However ... I am wondering how it is now possible to add security to this
new method or do I need to leave the interfaces explicit to get value from
annotations etc..

I don't mind loosing annotaions for hardwiring code like isPermitted etc as
its now just in one method...

I obviously cant change the @RequiresPermissions(..[something related to
T]..) ;-) or currentUser.hasRole(..[something related to T]..)

Just wondering if anyone has come across this type of pattern and how it
might be solved elegantly ?

Thanks
-A-

-- 
View this message in context: 
http://n2.nabble.com/Security-on-Generic-interfaces-tp4607155p4607155.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to