Show TOC

Application Managed AuthenticationLocate this document in the navigation structure

Definition

For the Application Managed Authentication, the application may use its own authentication and passes the authenticated credentials (Client, Language, User and Password) for the connection creation. These credentials will be checked again by the SAP system.

To do this, you need to retrieve the ConnectionFactory (described in the sections above) and cast it to ConnectionSpecFactory ):

ConnectionFactory connectionfactory = ………………;  
Connection connection = null;  ConnectionSpec cs = null;  
ConnectionSpecFactory csf = null;  
csf = (ConnectionSpecFactory) connectionfactory;  
cs = csf.createConnectionSpec(client, user, pass, lang);  
connection = connectionfactory.getConnection(cs); 
         

You can also create a ConnectionSpec instance with a destination configured on the Destination Service:

cs = csf.createConnectionSpec(destinationName);
connection = connectionfactory.getConnection(cs);
         

Thus you can dynamically define the destination of your call.

Additionally, the entry

<res-auth>Application</res-auth>

should exist in the application descriptor.

If your application gets the destination name at runtime, you can use the interface SAPConnectionFactory that enables you to create a RecordFactory and a connection to a specific destination.

The ConnectionFactory eis/SAPJRAFactory is a preconfigured ConnectionFactory that is delivered with the Application Server Java.

Thus, you can reference to eis/SAPJRAFactory (or to any other ConnectionFactory ) and/or to the ejb descriptor.

In a next step you can define connectionFactory or recordFactory with your specific destination.

You can navigate directly to this interface as follows:

SAPConnectionFactory connectionfactory = (SAPConnectionFactory)ctx.lookup(java:comp/env/eis/SAPJRAFactory); 
 
// get RecordFactory 

recordfactory = connectionfactory.getRecordFactory("MyDestinationNameXXX"); 

// get Connection handle 

connection = connectionfactory.getConnection("MyDestinationNameYYY"); 
connection = connectionfactory.getConnection("MyDestinationNameZZZ"); 


         
Further Information

The section Facades and Compilation describes how to access the ConnectionSpecFactory interface.