Skip Navigation

Authenticating and Requesting Authorization to Use Services

The steps in this procedure show how a Red App authenticates in SRWRuntime and requests authorization to use a service.

You need the following values:

  • RequestorId or Red App ID. The Red App ID is passed in the Java code as a RequestorId, and this ID is also passed in redapp.xml. Sabre assigns a Red App ID to your Red App to uniquely identify your app.

  • Service context name. This is the service name that your Red App will access. All Red Apps that use communications services register a service context name with SRWRuntime. The service context name is passed in the Java code, and in the redapp.xml file as the name attribute of the Authorization entry. Every service that is registered with SRWRuntime has a unique name.

  • threshold. The threshold is the quantity of operations on the service. This value is passed in the Java code and redapp.xml. In the Authorization entity, you define the quantity of operations in the threshold attribute, with an optional metric attribute, expressed either as transactions per second (tps) or transactions per minute (tpm).

        If you do not add the metric attribute, the default is transactions per second.

  1. Using Eclipse, add the following required dependencies to your plug-in project:



    • com.sabre.edge.platform.core.common

  2. Get the authentication token service. This service obtains the token for your Red App. It is recommended that you load this service once and store it in a class attribute, for example, your Red App Activator. Sample code for the AbstractEdgeBaseNonUIPlugin class that exposes the getServiceReference method is shown below.

public class Activator extends AbstractEdgeBaseNonUIPlugin
    private static Activator plugin;

    private IAuthenticationTokenService tokenService;

    public void start(BundleContext context) throws Exception
        plugin = this;

    public void stop(BundleContext context) throws Exception

        plugin = null;

    public static Activator getDefault()
        return plugin;

    public String getToken()
        if (tokenService == null)
            tokenService = getServiceReference(IAuthenticationTokenService.class);

        return tokenService.getToken();


  1. Create a ServiceContext object. This object passes information to the Bus. ServiceContext context = new ServiceContext();

  1. Set the service ContextName, RequestorId, and Token attributes of the service context object. An example is shown below.

context.setRequestorId("Red App ID");


  1. Set other required service context attributes, such as the request object. The service context attributes that you are required to set depend on the services that your Red App uses. To obtain the service context attributes, see the topics that are dedicated to those services.

  1. Invoke the process() method on an SRWRuntime instance.

  2. Add a redapp.xml file. To the RedApp entity in the file, add one Authorization child element for each service that your Red App will access. In Authorization, a Red App requests authorization to use a service. Add the name attribute to each Authorization entity. An example of a request for authorization is shown below.

You can specify threshold as either tps or tpm. Building a redapp.xml file explains variations that are based on service.
  <RedApp id="Red App ID" >
    <Authorization name="ContextName" threshold="1" />


  1. Add redapp.xml to the bin.includes list in build.xml of the plug-in that has communications. This ensures that your redapp.xml file is included when you create an exported jar file.

  1. Using Eclipse, add the extension point to the plugin.xml of the plug-in that is registering services, registering event listeners, or consuming services. This extension point triggers SRWRuntime to search for redapp.xml.