| | |
| | | |
| | | // Build the array of connections we will use to perform the tests. |
| | | JmxConnectionHandler jmxCtx = getJmxConnectionHandler(); |
| | | ArrayList<JmxClientConnection> connList = |
| | | new ArrayList<JmxClientConnection>(); |
| | | ArrayList<Boolean> successList = new ArrayList<Boolean>(); |
| | | ArrayList<JmxClientConnection> connList = new ArrayList<>(); |
| | | ArrayList<Boolean> successList = new ArrayList<>(); |
| | | String userDN ; |
| | | Entry userEntry ; |
| | | AuthenticationInfo authInfo; |
| | |
| | | { |
| | | OpendsJmxConnector opendsConnector; |
| | | int jmxPort = TestCaseUtils.getServerJmxPort() ; |
| | | HashMap<String, Object> env = new HashMap<String, Object>(); |
| | | HashMap<String, Object> env = new HashMap<>(); |
| | | String user = "cn=Unprivileged JMX Root,cn=Root DNs,cn=config"; |
| | | String password = "password"; |
| | | String[] credentials = new String[] { user, password }; |
| | |
| | | |
| | | // Add JMX_READ privilege |
| | | InternalClientConnection rootConnection = getRootConnection(); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | } |
| | | |
| | | // remove JMX_READ privilege |
| | | mods = new ArrayList<Modification>(); |
| | | mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | |
| | | "givenName: ProxyV1", |
| | | "sn: Test"); |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control( |
| | | DN.valueOf("cn=PWReset Target,o=test"))); |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | ArrayList<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control(targetDN)); |
| | | |
| | | |
| | |
| | | "givenName: ProxyV2", |
| | | "sn: Test"); |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:cn=PWReset Target,o=test"))); |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | ArrayList<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control(ByteString.valueOf("dn:" + targetDN))); |
| | | |
| | | |
| | |
| | | |
| | | // Modify the user entry to add the JMX_READ privilege and verify that |
| | | // the client connection reflects that. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = rootConnection.processModify(dn, mods); |
| | |
| | | // Update the set of root privileges to include proxied auth. |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |