Modeshape and authorization
discger Sep 5, 2013 10:17 AMHello,
at the moment I'm evaluating Modeshape for my company. One of the most important things we need is a proper authorization system.
The web application we're working on will be Java EE 6 based and JBoss 7.x will be the app server. Additionally a network drive mapping via webdav would be fine. The user information (credentials, ...) will be stored in a database or in our LDAP directory. The roles are stored in the database.
My first question:
Can I reuse the data stored in the Backends for Modeshape authentication/authorization (users & roles)? Can I reuse the credentials from the form-based login of the web app I already asked the user for?
After that I would like to create folder structures with fine grained authorization such as:
Given is a structure like that:
/projects/project_a
/projects/project_b
/public
User A should be able to read write access project a
User B should be able to read write access project b
User B should be able to just read project a
User C should only see /public
My second question:
Is such a system possible with Modeshape? Can I use groups to assign priviledges?
I played around a bit with the ACLs of version 3.5. Here is a bit of my code:
First I create or retrieve an AccessControlList object
try { acl = (AccessControlList) am.getApplicablePolicies(node.getPath()).nextAccessControlPolicy(); } catch (NoSuchElementException e) { acl = (AccessControlList) am.getPolicies(node.getPath())[0]; }
Then I clear the existing ACLs
for (AccessControlEntry entry : acl.getAccessControlEntries()) { acl.removeAccessControlEntry(entry); }
To set ACL entries I do
acl.addAccessControlEntry(admin, privileges_all); am.setPolicy(node.getPath(), acl); session.save();
I have the following directory structure
/test1
As I understand if I set an ACL of JCR_ALL for user admin on the test1 folder no other user should be able to access this folder. But this is not the case. The nodes have the mixin of mode:accessControllable.
My third question:
Where am I wrong? Do I have to do special config changes to activate ACLs? Is there some example code or test cases on how to use ACLs? Will there be some documentation in the future about this topic?
Thanks in advance.
Greetings, Dieter
-
code.txt.zip 882 bytes