The second step in implementing basic authentication is to create
a token generator for the request message to be sent by the import. The token
generator reads the user name and password from the configuration file and
generates the username token with the user name and password.
Before you create a token generator, you should ensure that you have
created a security token, as described in the topic "Creating a security token
for the request message."
To create a token generator for the request message:
- If the module deployment editor is closed, open it by completing
the following steps:
- In the Business Integration view, select
the module that contains your Web services import, as shown in the following
figure:

- Right-click the selected module and select Open Deployment
Editor. The module deployment editor opens.
- Click the Import WS-Security tab.
- Click the WS Binding tab. The Web Services
Client Bindings page opens, as shown in the following figure:

- In the Service references section, select
the Web service reference corresponding to your Web service import. For example,
in the above figure, the Web service reference sca/import/sendWebServiceCallToServer is
selected.
- In the Port Qualified Name Binding section,
select the port qualified name binding that you want to use for the Web service
reference that you selected. The port qualified name binding comes from the
port name of your Web service import. For example, in the above figure, the
port qualified name binding receiveWebServiceCallFromClient_ServerInterfaceHttpPort is
selected.
- Expand the Security Request Generator Binding Configuration section.
- Expand the Token Generator subsection.
- Click Add. The Token Generator dialog box
opens.
- In the Token generator name field, type
a name for the new token generator. For example, basicAuthToken.
- In the Token generator class field, ensure
that the following token generator class is selected: com.ibm.wsspi.wssecurity.token.UsernameTokenGenerator.
- In the Security token field, select basicAuth.
(This is the name of the security token that you created earlier on the WS
Extension page of the module deployment editor.)
- Select the Use value type check box.
- In the Value type field, select Username
Token. (The Local name field is automatically
populated to reflect your selection of Username Token.)
- In the Call back handler drop-down list,
ensure that the following call back handler is selected: com.ibm.wsspi.wssecurity.auth.callback.NonPromptCallbackHandler.
This call back handler enables you to manually specify a user
ID and password within the token generator configuration.
- In the User ID and Password fields,
specify the user ID and password for the client. For example, if you set up
the sample custom user registry by following the instructions in the topic
"Enabling security on the server", you would type wid as
both the user ID and password. The Token Generator dialog box should now resemble
the following figure:

- Click OK. The new token generator basicAuthToken is
displayed, as shown in the following figure:

- Press Ctrl-S to save your changes.
Now that you have created a token generator, you should create a
required security token by following the instructions in the topic "Creating
a required security token for the request message."