DevPortal

How do I add AllPermission to Nobody Group using MBean API?


To add any permission to the Realm in Pramati Server you have to follow these steps:

  1. Get the com.pramati.services.security.spi.admin.RealmMBean for the Realm to which you want to add/delete permissions.
  2. Create a com.pramati.services.security.PolicyEntry for the permission.
  3. 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);


© Pramati Technologies 2007 Runs on Pramati Server | Feedback | Legal