{{Quickfixn}} Detecting wrong password in Initiator

Pavel pavka1799 at gmail.com
Tue May 22 14:10:02 PDT 2018


Hello!

Please advise, what is the proper handling of wrong credentials on logon in
initiator?

At the start of application Logon window is displayed to prompt for user
name + password, and in case of logon failure corresponding message should
be displayed, prompting for correct input again. How is this scenario
supported by QuickFix/n?

In case username/password is wrong, QuickFix/n Initiator will keep on logon
attempts, and I could not find any other handler of this situation but in
"IApplicationExt.FromEarlyIntercept". Apparently no other handler is called
in such a case, all logic is kept internally within the QuickFix/n engine -
it just continues logon failures with the wrong password every
<ReconnectInterval> seconds...

So, my questions are:
1. To handle invalid username/password - is it correct to catch "logout"
(MsgType=5) messages in "FromEarlyIntercept"?
(Also it implies having a flag that logon is in progress, to distinguish
"wrong credentials logout" from other scenarios...)

2. How to stop Initiator from logons with the wrong credentials - is
calling the session's "Logout" a proper solution?

3. The below code - does it look generally correct to handle invalid
credentials in the client (initiator) app with a Logon window (assuming
Connect() is called from the Logon window)?

Thank you!

Best regards,
Pavel

public void Connect(..)
{
    ...
    _connecting = true;
    _initiator.Start();
    ....
}

...

public void FromEarlyIntercept(Message msg, SessionID sessionID)
{
    if (_connecting)
    {
        string msgType = msg.Header.GetField(Tags.MsgType);
        switch (msgType)
        {
            case MsgType.LOGOUT: // Got logout when connecting - wrong
credentials?
                Session.LookupSession(sessionID).Logout("Invalid
credentials"); // Stop further logon attempts?
                <signal logon failure / wrong credentials to the Logon
Window>
                break;
            ...
        }
    }
   ...
}

public void OnLogon(SessionID sessionID)
{
    ...
    _connecting = false;
    ...
}
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20180522/f5dbc9ae/attachment.html>


More information about the Quickfixn mailing list