/** * Create a new JNDI Realm. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createJNDIRealm(String parent) throws Exception { // Create a new JNDIRealm instance JNDIRealm realm = new JNDIRealm(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.setRealm(realm); // Return the corresponding MBean name ObjectName oname = realm.getObjectName(); if (oname != null) { return (oname.toString()); } else { return null; } }
/** * Create a new JNDI Realm. * * @param parent * MBean Name of the associated parent component * * @exception Exception * if an MBean cannot be created or registered */ public String createJNDIRealm(String parent) throws Exception { // Create a new JNDIRealm instance JNDIRealm realm = new JNDIRealm(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.setRealm(realm); // Return the corresponding MBean name ObjectName oname = realm.getObjectName(); if (oname != null) { return (oname.toString()); } else { return null; } }
private void setUpWithPassword(String password) throws Exception { storedPassword = password; ldapRealm = new LdapRealm(); Field field = JNDIRealm.class.getDeclaredField("context"); field.setAccessible(true); field.set(ldapRealm, prepareContext()); ldapRealm.setContainer(prepareContainer()); ldapRealm.setUserSearch(""); ldapRealm.init(); }