|
To add any permission to the Realm in Pramati Server you have to follow these steps:
- Get the
com.pramati.services.security.spi.admin.RealmMBean for the Realm to which you want to add/delete permissions.
- Create a
com.pramati.services.security.PolicyEntry for the permission.
- Use the
RealmMBean methods for add/remove the permissions.
A sample code is given below to add AllPermission to the nobody group.
InitialContext ic = new InitialContext();
J2EEServerMBean j2EEServerMBean = (J2EEServerMBean) ic.lookup("root-server-mbean");
SecurityServiceMBean securityServiceMBean = j2EEServerMBean.getSecurityService();
RealmMBean realmMBean = securityServiceMBean.getRealm("system"); //realm name
LinkedList groups = new LinkedList();
groups.add("nobody");
PolicyEntry policyEntry = new PolicyEntry("AllPermission", "AllPermission",null, groups);
realmMBean.addPermission(policyEntry);
|