9.6.2.1 Enabling Authentication
9.6.2.2 Adding User Name and Password
9.6.2.3 Deleting User Name and Password
The AdventNet HTTP Connector supports Authentication feature. It follows a simple challenge-response authentication, where the server challenges (when the feature is enabled) the client to authenticate itself and the client responds with the authentication information. This Authentication is based on User name and Password and is a basic authentication.
9.6.2.1 Enabling Authentication
The agent authenticates the users, when they connect through the HTTP Connector, only if the Authentication feature is enabled. This feature can be enabled either from the JMX Compiler user interface or using API calls.
9.6.2.1.1 Using JMX Compiler UI
Follow the steps given below to enable the Authentication feature from the JMX Compiler UI.
Select Project->Settings menu option. Settings dialog appears.
Select Adaptors->HTTP->Authentication option from the tree in the Settings dialog.
Enable the Authentication option in the HTTP Authentication panel that appears on the right hand side.
Now, on generating code for the agent, code is generated to authenticate the users when they connect to the agent using HTTP Connector. The user entries that have been added are stored in a text file, HttpAuthTable.txt. This file is created under the <projectdir>/agent/bin/etc directory during code generation.
If user entries are added from the JMX Compiler user interface, this file is created with these entries. In case user entries are not added from the UI before generating the code, the file is created with a default user entry where user name and password are jmx and root respectively.
9.6.2.1.2 Using API
The authentication feature can be enabled by adding the following code (shown in bold) to the registerAdventNetAdaptors() method in the agent main file:
httpconnector= new HttpConnector();
httpconnector.setParentDir(agentDir);
httpconnector.registerAuthentication();
httpconnector.addHttpServerInterface(new HttpConnectorServerImpl());
name = "Adaptors:type=HTTPConnector";
server.registerMBean(httpconnector, new ObjectName(name));
The line of code (shown in bold in the above code snippet), when added to the agent main file, enables Authentication support. When you enable authentication using APIs, the HttpAuthTable.xml file present in the <Agent Toolkit Home>/etc directory has to be copied to the <projectdir>/agent/bin/etc directory.
In addition to this, check if the text file HttpAuthTable.txt is present in the <projectdir>/agent/bin/etc directory. If it is not present, it has to be copied from <Agent Toolkit Home>/etc directory and placed here. For a user entry with User name and Password: jmx and
root, the HttpAuthTable.txt file must have the following lines:
<?xml version="1.0" encoding="UTF-8"?>
<Table>
<row>
<column name="user" value="root" ></column>
<column name="password" value="public" ></column>
</row>
</Table>
9.6.2.2 Adding User Name and Password
In case user entries are added from the JMX compiler user interface, the HttpAuthTable.txt file is created with these entries. Otherwise, the text file is created with the default user name and password entries, jmx and root respectively. New user entries
can be added using any one of the following:
Using the JmxCompiler UI (requires re-generation of code)
Modifying the HtmlAuthTable.txt ( requires the agent to be restarted)
9.6.2.2.1 Using JMX Compiler UI
User entries may be added from the JMX compiler user interface before generating code for the agent. If entries are added after code generation, the code has to be re-generated. Follow the steps given below to add user name and password from the JMX Compiler user interface:
Select Project->Settings menu option. The Settings dialog appears.
Select Adaptors->HTTP->Authentication option from the tree in the Settings dialog.
Ensure Authentication option is enabled.
Click the Add button at the bottom of the table.
Enter the following values in the dialog that appears:
User Name
Password
Press OK button.
Any number of users can be added for authentication using the above option. All the user entries added from the UI are persisted in the HttpAuthTable.txt file.
9.6.2.2.2 Editing HttpAuthTable.txt
The HttpAuthTable.txt file is present in the <projectdir>/agent/bin/etc directory. User name and password entries can also be added directly to this file. To add a sample entry with the following values, user name: xyz and password: mypass, the
following lines should be added to the HttpAuthTable.txt file:
<row>
<column name="user" value="xyz" ></column>
<column name="password" value="mypass" ></column>
</row>
The user entries added to the file are reflected only when the agent is restarted.
9.6.2.3 Deleting User Name and Password
The user entries can be deleted by any one of the following methods:
9.6.2.3.1 From JMX Compiler UI
The JMX Compiler user interface allows you to view the HttpAuthTable. All the user entries are listed in the table. Follow the steps given below to delete an entry:
Select Project->Settings menu option. The Settings dialog appears.
Select Adaptors->HTTP->Authentication option from the tree in the Settings dialog.
Ensure Authentication is enabled. The HttpAuthTable is displayed.
Select the rows to be deleted.
Press the Delete button at the bottom of the table. The selected entries are deleted.
9.6.2.3.2 Editing the HttpAuthTable.txt file
The user entry can also be deleted by editing the HttpAuthTable.txt file present in the <projectdir>/agent/bin/etc directory. This can be done by deleting the rows corresponding to the user entry in the text file. But, these changes will be reflected only when the agent is restarted.
A sample entry was given in the section Adding User name and passwords. In order to delete this entry from the text file, the following lines (that were inserted while adding the entry) must be deleted from the file.
<row>
<column name="user" value="xyz" ></column>
<column name="password" value="mypass" ></column>
</row>
Note: All the entries in the HttpAuthTable.txt file must not be deleted at a time. In case all entries are deleted, you will not be able to log in to access the agent through HTTP Connector.