3 Configuring the Login Environment

This chapter contains the following topic:

3.1 Configuring the Login

For an AIS client to call AIS services, the AIS client must first obtain a login environment by passing the following information to the constructor in the LoginEnvironment object:

  • EnterpriseOne login credentials. EnterpriseOne credentials include a user ID, password, environment, and role. The AIS Server configuration uses a default EnterpriseOne environment and role unless you specify a different environment and role here.

  • AIS Server URL and the device name. The device name is a string that represents the device on which the client is running. The device name serves as a unique identifier for your client.

  • A list of required capabilities. (Optional) If the AIS client uses AIS Server capabilities, then you have the option to pass a list of required capabilities to the LoginEnvironment constructor. The LoginEnvironment constructor verifies that the capabilities are available on the AIS Server. If they are available, access to the AIS client is granted. If they are not available, access is denied.

    This prevents an AIS client from running if the AIS Server capability that it requires to properly function is not available in the version of the AIS Server. See Understanding AIS Server Capabilities for a list of AIS Server capabilities available by EnterpriseOne Tools release.

When the client requests a LoginEnvironment, the processing within the API uses the defaultconfg and tokenrequest URI, the endpoints described in Table 1-1, "Endpoint URIs for Accessing EnterpriseOne Applications and Data".

Example 3-1 Examples for Obtaining a Login Environment

//login with minimum required information
final String AIS_SERVER = "http://ais.company.com:7777";
final String USER_NAME = "jde";
final String PASSWORD = "jde";
final String DEVICE = "Java";
LoginEnvironment  loginEnv = new LoginEnvironment(AIS_SERVER, USER_NAME, PASSWORD, DEVICE);
 
//login overrides default environment and role
final String ENVIRONMENT = "PROD";
final String ROLE = "PROLE";
LoginEnvironment  loginEnv2 = new LoginEnvironment(AIS_SERVER, USER_NAME, PASSWORD, ENVIRONMENT, ROLE, DEVICE);
 
//login with required capabilities
//A CapabilityException will be thrown if AIS doesn't have those in the list
final String REQ_CAPABILITIES = "grid, processingOption";
LoginEnvironment  loginEnv3 = new LoginEnvironment(AIS_SERVER, USER_NAME, PASSWORD, DEVICE, REQ_CAPABILITIES);
 
//login with token
String PS_TOKEN = "a ps token string";
LoginEnvironment  loginEnv4 = new LoginEnvironment(AIS_SERVER, USER_NAME, null, null, null, DEVICE, null, null, PS_TOKEN) 

All calls to the AIS Server include the LoginEnvironment object. From this point forward in this guide, references to the loginEnv variable assume that this step has been performed and that the variable is available.

3.2 Configuring the Logout

When finished making calls to the AIS Server, you must include the following logout call to end the user session:

AISClientUtilities.logout(loginEnv);