Java SDK for Windows
Inside the "libs" folder, within the java folder, there is a jar named "aapm-sdk-1.0.0.jar," which contains the SDK to be used by Java application developers. It is important to note that the SDK jar is a fat jar because all the necessary components for gRPC are packaged within it. The Java SDK is developed for a minimum version of 1.8.
At this point, the developer should open their relevant Integrated Development Environment (IDE) and include this jar in their project. For example, if a developer is developing a Java application named SampleApplication, the way to use the AAPM Java SDK within Maven is as follows:
The above sample code executes a call through the class named PasswordManager within the SDK. When we run this code, the following output appears on the screen:
Let's delve into the classes provided by the SDK:
PasswordManager: This class serves as the communicator between the agent and gRPC. In its simplest form, it can be utilized as follows:
PasswordManager manager = PasswordManager.instance();
In the example above, the necessary port for communication with the Agent via gRPC has not been passed as a parameter to this class. If no parameters are provided to the PasswordManager.instance() method, this class will default to retrieving and utilizing the value of grpc.port key under \HKEY_LOCAL_MACHINE\SOFTWARE\KronAapm\Prefs in the Windows Registry of the host server. Additionally, it will utilize localhost as the Agent's IP address.
To fetch cached passwords using the PasswordManager's Agent, the getPassword method should be used. The parameters to be used in the getPassword method are, in sequence: AccountName, Token, and Account Path.
Response: GetResponse method returns an object of type Response, which is a class contained within the SDK. This class is designed to encapsulate relevant error messages along with its other properties.
Below, the response message demonstrates an erroneous message received by the agent. In subsequent sections, a comprehensive list of error messages will be provided for reference.
In the ApplicationTest code snippet above, the PasswordManager call is used with a method named httpAddress. This method is directly supplied with the argument of the Kron PAM address. This call allows applications using the SDK to directly access Kron PAM if either the AAPM Agent is not desired to be used or is momentarily inaccessible. This flexibility ensures that applications leveraging the SDK can seamlessly interact with Kron PAM, even under varying access conditions or preferences regarding the use of the AAPM Agent. When the AAPM Service is stopped, and the relevant code is reinvoked, the result from the SDK can be observed directly as retrieved from Kron PAM, as shown below.
ļ»æ