For the authentication method Application Managed Authentication the application may use its own authentication and passes authenticated credentials (Client, Language, User and Password) to establish the connection creation. These credentials will then be checked again by the SAP system.
Following structure is also needed to allow your own credentials to be passed:
ConnectionFactory connectionfactory = null;
Connection connection = null;
ConnectionSpec cs = null;
ConnectionSpecFactory csf = null;
csf = (ConnectionSpecFactory)ctx.lookup("ConnectionSpecFactory");
cs = csf.createConnectionSpec(client, user, pass, lang);
// see in previous paragraphs how to aquire connectionFactory
connection = connectionfactory.getConnection(cs);
At development time your application should reference to DC tc/bl/jra, public part API (see SC J2EE_CONN) in the SAP JDI, to get access to the interface ConnectionSpecFactory.
As with DefaultAuthentication, the application descriptor should contain the following entry:
<res-auth>Application</res-auth>