Package ubic.gemma.core.security
It is based on Spring Security, with several extensions (and some things it does not support).
Top-level concerns:
- Adding ACLs to entities at creation time.
- Entity and Method security.
- Managing security on entities
It does not address authentication and user management. However, it does define some standard group authorities: ADMIN, USER, ANONYMOUS, AGENT and applies appropriate permissions to these to objects
Using Gsec
Use Gemma as an example for how it is set up.
Include the Acl*hbm.xml hibernate configuration files in your SessionFactory declaration.
Use those files in your DDL generation to add the tables to your database.
Run the SQL in init-acl-indices.sql to further tune the Acl tables.
Subclass BaseAclAdvice and wire into your CRUD methods. For example Gemma uses the SystemArchitectureAspect.modifier() pointcut.
Include the applicationContext-component-scan.xml bean definitions file in your context configuration.
Any other security configuration will have to be provided in additional bean declarations.
The Gsec secure entity data model
We define four types of Secure entities (Secure means they are subject to authorization checks), which are indicated by implementing one of four interfaces:
- Securable, which is the generic top-level interface. Secure objects have an owner, and may or may not have associated objects which inherit security from the parent. Similarly Secure objects can have a parent, from which they will inherit permissions if the parent is defined.
- SecuredChild, which are objects that never have their own specific permissions, but inherit them from a Securable. SecuredChildren have ACLs, but no ACEs (at least, if they exist they are not used)
- SecuredNotChild, which denotes objects that have their own security and never inherit from an associated parent object.
- SecureValueObject, which allows adding security filtering to methods that return value objects instead of actual entities.
Adding ACLs to entities at creation time
Applications wire an implementation of BaseAclAdvice to their methods that create or update Securables.
Method security
Gsec provides a range of implementations of AbstractAclProvider to filter the return objects coming from @Secured methods, including support for value objects, filtering maps by values or by keys, etc.
Managing security on entities
Gsec defines a SecurityService interface for various manipulations and checking of permissions on Securables. Currently no implementation is provided (awaiting refactoring out of Gemma).
Gsec also provides some utility methods in SecurityUtil.
TODO
- The special AclPrincipalSid and AclGrantedAuthoritySid might not be needed, to be replaced with the generic PrincipalSid and GrantedAuthoritySid from spring security. This would also mean some of the other classes can be reverted to the generic ones provided from spring security.
-
ClassDescriptionDefines constants used in GrantedAuthories.Method-security configuration for Gemma, replacing the deprecated XML
<s:global-method-security>block inapplicationContext-security.xml.Core Spring Security wiring for Gemma, replacing the legacyapplicationContext-security.xml.High-level methods for security-related manipulations.Methods for changing security on objects, creating and modifying groups, checking security on objects.