Message-ID: <1186973683.16971.1711629306226.JavaMail.root@ovh3sttqfj1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_16970_1257058478.1711629306226" ------=_Part_16970_1257058478.1711629306226 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Implementing Custom Logons

Implementing Custom Logons

If you need to add fields to the logon message when you initiate= a session, do it in the toAdmin callback of the Applica= tioninterface. For example, a counterparty may ask to have a user id= entifier placed in the SenderSubID field and a password put into the RawDat= a field.

=20

In the toAdmin callback, if the message is a logon message = (being sent to the counterparty) then add your fields. The sent message wil= l include whatever changes you make to the Logon message in the callback.=20

=20
private String userID;
private String password;

public void toAdmin(Message message, SessionID sessionId) {
    if (isMessageOfType(message, MsgType.LOGON)) {
        addLogonField(message);
    }
    super.toAdmin(message, sessionId);
}

private void addLogonField(Message message) {
    message.getHeader().setField(new SenderSubID(userID));
    message.getHeader().setField(new RawDataLength(password.length()));
    message.getHeader().setField(new RawData(password));
}

private boolean isMessageOfType(Message message, String type) {
    try {
        return type.equals(message.getHeader().getField(new MsgType()).getV=
alue());
    } catch (FieldNotFound e) {
        logErrorToSessionLog(message, e);
        return false;
    }
}

private void logErrorToSessionLog(Message message, FieldNotFound e) {
    LogUtil.logThrowable(MessageUtils.getSessionID(message), e.getMessage()=
, e);
}
=20
------=_Part_16970_1257058478.1711629306226--