Getting started with the OAS SOAP Wrappers for user authentication

In this tutorial we'll be authenticating an existing user against OAS. To get started we will log into OAS and perform the following steps:

  1. Create a user
  2. Register a client component for our integrating server

Creating a user

First we need to log in to the Web Administration Service as an administrator and click on Users->Create from the menu. We will then need to enter a user id and static password:

Creating a user in the WAS

Registering a client component

A client component is used to specify integrations that are allowed to talk to OAS, here we can also configure the policy that will be used to process a request coming from this specific client component. To create one, click on Clients->Register:

Creating a client in the WAS

Here we see the following options:

  1. Client Type: the name of the client, this field is both a drop-down for pre-defined options as well as a free-text field for you to enter a custom component name (ex. SOAP-Auth)
  2. Location: the ip address from where the request will be originating. Ensure that you have the correct ip (ex. the ip address of a load balancer if you are using one), otherwise you will receive an error stating that a client component was not found.
  3. Policy ID: name of the policy which you wish to use when a request is processed for this client component (ex. Idenitkey Local Authentication).
  4. Protocol ID: the interface with which you will be communicating (either SOAP or RADIUS)

Integrating the wrapper

First we will need a Java project and we will need to list both the IdentikeyWrapper.jar and IdentikeySOAPClient.jar as dependencies (either add them to the project as a library or specify them in your mvn pom.xml/gradle build file).

You may notice that there are several beans exposed by the SOAP Wrappers (Administration, Authentication, Configuration, etc.), you should centralize an instance of the configuration bean as it will most likely be common unless you are communicating with multiple servers.

First we will create a configuration bean and set some properties like the server location and client component that we just created above. Ensure that the SOAP url and component name match the OAS server's ip address and the client component, otherwise you will not be able to reach the server/will receive an error message.

ConfigurationBean configurationBean = new ConfigurationBean();
configurationBean.setPrimarySoapURL("https://10.10.200.75:8888");
configurationBean.setAuthenticationComponent("SOAP-Auth");

Whenever we create a bean of another type, we will pass an instance of the configuration bean in the constructor (otherwise it will use values hardcoded in a properties file inside the Wrappers jar file which is not something we want). For this example, we will create an authentication bean which we will use to authenticate the user:

AuthenticationBean authenticationBean = new AuthenticationBean(configurationBean);

// domain, userID, pin, dpResponse, staticPwd, requestHostCode
AuthenticationCommandResponse authenticationCommandResponse = 
authenticationBean.authUser("master", "user", null, null, "Test1234", Credentials.RequestHostCode.No);

System.out.println("Return Code: " + authenticationCommandResponse.getReturnCode() + "\nStatus Code: " + authenticationCommandResponse.getStatusCode());

If everything went well, you should have the following printed in your console/logs:

Return Code: 0
Status Code: 0

If both the status code and return code are 0, the call was successful.

Complete example

ConfigurationBean configurationBean = new ConfigurationBean();
configurationBean.setPrimarySoapURL("https://10.10.200.75:8888");
configurationBean.setAuthenticationComponent("SOAP-Auth");

AuthenticationBean authenticationBean = new AuthenticationBean(configurationBean);

// domain, userID, pin, dpResponse, staticPwd, requestHostCode
AuthenticationCommandResponse authenticationCommandResponse = authenticationBean.authUser("master", "user", null, null, "Test1234", Credentials.RequestHostCode.No);

System.out.println("Return Code: " + authenticationCommandResponse.getReturnCode() + "\nStatus Code: " + authenticationCommandResponse.getStatusCode());
Show Comments