Home | Download | PDF | API | FAQ | Search | Feedback | History

> ## Securing EIS Applications

> In EIS applications, components request a connection to an EIS resource. As part of this connection, the EIS can require a sign-on for the requester to access the resource. The application component provider has two choices for the design of the EIS sign-on:

> - In the container-managed sign-on approach, the application component lets the container take the responsibility of configuring and managing the EIS sign-on. The container determines the user name and password for establishing a connection to an EIS instance. For more information, read Container-Managed Sign-On.
> - In the component-managed sign-on approach, the application component code manages EIS sign-on by including code that performs the sign-on process to an EIS. For more information, read Component-Managed Sign-On.

> You can also configure security for resource adapters. Read Configuring Resource Adapter Security for more information.

> ### Container-Managed Sign-On

> In container-managed sign-on, an application component does not have to pass any sign-on security information to the `getConnection()` method. The security information is supplied by the container, as shown in the following example.

>     // Business method in an application component
>     Context initctx = new InitialContext();
>     // Perform JNDI lookup to obtain a connection factory
>     javax.resource.cci.ConnectionFactory cxf =
>          (javax.resource.cci.ConnectionFactory)initctx.lookup(
>           "java:comp/env/eis/MainframeCxFactory");
>     // Invoke factory to obtain a connection. The security
>     // information is not passed in the getConnection method
>     javax.resource.cci.Connection cx = cxf.getConnection();
>     ...

> ### Component-Managed Sign-On

> In component-managed sign-on, an application component is responsible for passing the needed sign-on security information to the resource to the `getConnection()` method. For example, security information might be a user name and password, as shown here:

>     // Method in an application component
>     Context initctx = new InitialContext();
>     // Perform JNDI lookup to obtain a connection factory
>     javax.resource.cci.ConnectionFactory cxf =
>          (javax.resource.cci.ConnectionFactory)initctx.lookup(
>            "java:comp/env/eis/MainframeCxFactory");
>     // Get a new ConnectionSpec
>     com.myeis.ConnectionSpecImpl properties = //..
>     // Invoke factory to obtain a connection
>     properties.setUserName("...");
>     properties.setPassword("...");
>     javax.resource.cci.Connection cx =
>       cxf.getConnection(properties);
>     ...

> ### Configuring Resource Adapter Security

> A resource adapter is a system-level software component that typically implements network connectivity to an external resource manager. A resource adapter can extend the functionality of the Java EE platform either by implementing one of the Java EE standard service APIs (such as a JDBC driver), or by defining and implementing a resource adapter for a connector to an external application system. Resource adapters can also provide services that are entirely local, perhaps interacting with native resources. Resource adapters interface with the Java EE platform through the Java EE service provider interfaces (Java EE SPI). A resource adapter that uses the Java EE SPIs to attach to the Java EE platform will be able to work with all Java EE products.

> To configure the security settings for a resource adapter, you need to edit the `ra.xml` file. An example of an `ra.xml` file that configures resource adapter security can be found in the sample application file `<`AS_INSTALL`>\samples\connectors\apps\mailconnector\mailconnector-ra\src\conf\ra.xml`, assuming that you have installed the samples server. Here is an example of the part of the `ra.xml` file that configures the following security properties for a resource adapter:

>     <authentication-mechanism>
>       <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
>       <credential-interface>javax.resource.spi.security.PasswordCredential
>       </credential-interface>
>     </authentication-mechanism>
>     <reauthentication-support>false</reauthentication-support>

> You can find out more about the options for configuring resource adapter security by reviewing `<`AS_INSTALL`>/lib/dtds/connector_1_0.dtd`. You can configure the following elements in the resource adapter deployment descriptor file:

> - Authentication mechanisms

> Use the authentication-mechanism element to specify an authentication mechanism supported by the resource adapter. This support is for the resource adapter and not for the underlying EIS instance.

> There are two supported mechanism types:

> - `BasicPassword`, which supports the javax.resource.spi.security.PasswordCredential interface.
> - `Kerbv5`, which supports the javax.resource.spi.security.GenericCredential interface. The Sun Java System Application Server does not currently support this mechanism type.
> - Reauthentication support

> Use the reauthentication-support element to specify whether the resource adapter implementation supports re-authentication of existing `Managed-` `Connection` instanced. Options are `true` or `false`.

> - Security permissions

> Use the `security-permission` element to specify a security permission that is required by the resource adapter code. Support for security permissions is optional and is not supported in the current release of the Application Server. You can, however, manually update the `server.policy` file to add the relevant permissions for the resource adapter, as described in the Developing and Deploying Applications section of the Application Server's Developer's Guide (see a link to this document in Further Information).

> The security permission listed in the deployment descriptor are ones that are different from those required by the default permission set as specified in the connector specification.

> Refer to the following URL for more information on Sun's implementation of the security permission specification:

> `http://java.sun.com/products/j2se/1.5.0/docs/guide/security/PolicyFiles.html#FileSyntax`

> In addition to specifying resource adapter security in the `ra.xml` file, you can create a security map for a connector connection pool to map an application principal or a user group to a back end EIS principal. The security map is usually used in situations where one or more EIS back end principals are used to execute operations (on the EIS) initiated by various principals or user groups in the application. You can find out more about security maps in the Configuring Security chapter section of the Application Server's Administration Guide. A link to this guide can be found in Further Information.

> ### Mapping an Application Principal to EIS Principals

> When using the Application Server, you can use security maps to map the caller identity of the application (principal or user group) to a suitable EIS principal in container-managed transaction-based scenarios. When an application principal initiates a request to an EIS, the Application Server first checks for an exact principal using the security map defined for the connector connection pool to determine the mapped back end EIS principal. If there is no exact match, then the Application Server uses the wild card character specification, if any, to determine the mapped back-end EIS principal. Security maps are used when an application user needs to execute EIS operations that require to be executed as a specific identity in the EIS.

> To work with security maps, use the Admin Console. From the Admin Console, follow these steps to get to the security maps page:

> 1. Expand the Resources node.
> 2. Expand the Connectors node.
> 3. Select the Connector Connection Pools node.
> 4. Select a Connector Connection Pool by selecting its name from the list of current pools or create a new connector connection pool by selecting New from the list of current pools
> 5. Select the Security Maps page.