Scenario: End-to-end federated trusted connections, without user mappings
User mappings require a significant amount of administrative maintenance. This scenario illustrates how to configure federated trusted connections so that the federated system does not require user mappings.
User ID and password requirements
- The user ID and password for the connection originator must be available to the federated server, and the connection originator's user ID and password must be the same on the federated server and on the data source. The credentials are identified in a CONNECT statement that the connection originator issues or in an API call that the application makes. If the CONNECT statement is used, an implicit trusted connection is created, and the connection cannot be reused. If the application makes an API call and explicitly requests a trusted connection, an explicit trusted connection is created, and the connection can be reused.
- If the remote trusted context allows connection reuse without authentication, connection re-users must have the same user ID on the federated server and on the remote data source.
- If the remote trusted context allows connection reuse with authentication, connection re-users must have the same user name and password on the federated server and on the remote data source.
The scenario

- BOSS has the same user ID and password on the federated server and on the data source. Therefore, BOSS does not require a user mapping.
- Mary uses the same user ID on the federated server and on the data source, and the federated context allows her to connection without authenticating. Therefore, she does not require a user mapping.
- The application server, which hosts the insurance application and has the IP address 9.44.111.111.
- The federation server, which has the IP address 9.44.111.222.
- The remote database server, which is cataloged on the federated server as JUPITER.
- On the remote database server, create this trusted context object:
CREATE TRUSTED CONTEXT MY_DB2_TCX BASED UPON CONNECTION USING SYSTEM AUTHID BOSS ATTRIBUTES (ADDRESS '9.44.111.222') WITH USE FOR PUBLIC WITHOUT AUTHENTICATION ENABLE
This trusted context specifies that BOSS is the trusted connection originator and that the connection request must come from IP address 9.44.111.222, which identifies the federation server. The trusted context specifies WITH USE FOR PUBLIC WITHOUT AUTHENTICATION. Consequently, after the trusted connection is established, any valid user of the remote data source can reuse the connection by providing only a user ID.
- On the federation server, create this trusted context object:
CREATE TRUSTED CONTEXT MY_WFS_TCX BASED UPON CONNECTION USING SYSTEM AUTHID BOSS ATTRIBUTES (ADDRESS '9.44.111.111') WITH USE FOR PUBLIC WITHOUT AUTHENTICATION ENABLE
This trusted context specifies that BOSS is the trusted connection originator and that the request for the connection must come from the IP address 9.44.111.111, which identifies the application server. After the trusted connection is established, any valid user of the federated server can reuse the connection by providing only a user ID.
- On the federation server, create this server definition:
CREATE SERVER JUPITER TYPE db2/udb VERSION 9.5 WRAPPER drda... OPTIONS(DBNAME 'remotedb', ...);
This server definition contains the information that the federated server requires to connect to the remote database named remotedb.
The scenario, step-by-step
- The application server requests a trusted inbound connection for BOSS.
- BOSS performs a task, and the federated server establishes an explicit outbound trusted connection for BOSS. User ID BOSS is propagated from the application server through the federation server to the database server, where the actions that BOSS performs can be audited.
- Mary logs into the insurance application which is on her laptop. The application server switches the inbound connection to the federated server from BOSS to Mary.
- Mary performs a task within the application.
- The federation server switches the outbound connection from BOSS to Mary, and her ID is propagated through the federation server to the server, where the actions that Mary performs can be audited.