Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ugandhi #1
Member since May 2007 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Connection Issues with Kerberos / JID Mapping
I am having trouble connecting to my Jabber Server with the agsXMPP SDK.

I am using Kerberos Authentication.   Also I am using a JID Mapping process within the Jabber server where the windows NT userid gets mapped to a JID.

i.e.   ugandhi = window nt userid maps to upendra_gandhi@ml.com  which is the JID we are using.

Below is the code:

class JabberValidate
    {
        private static XmppClientConnection comp = null;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            // create a new component connection to the given serverdomain, port and password
            // a password is needed for the most servers for security reasons, if your server runs behind
            // a firewall or a closed company network then you could allow component connections without password.

            //if (args.GetUpperBound < 4)
            //    Console.WriteLine("And open the Connection again");

           

             
            comp = new XmppClientConnection();

            comp.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;


           
            // The Jid which this component will use
            Jid jid = new Jid("ugandhi@amrsd.windev.ml.com","30.0.12.12","testcode");

            //Jid jid = new Jid("ugandhi", "30.0.12.12", "bots code");
              

            comp.Server = jid.Server;
            comp.Username = jid.User;
            comp.Password = "xxxx01@";
            comp.Resource = jid.Resource;
            comp.Priority = 1;
            comp.Port = 5224;
            comp.UseSSL = false;
            comp.AutoResolveConnectServer = true;
                      
            comp.UseStartTLS = true;
           
           
            // Setup event handler
            comp.OnSaslStart += new SaslEventHandler(comp_OnSaslStart);
            comp.OnLogin    += new ObjectHandler(comp_OnLogin);
            comp.OnClose    += new ObjectHandler(comp_OnClose);
            comp.OnReadXml    += new XmlHandler(comp_OnReadXml);
            comp.OnWriteXml    += new XmlHandler(comp_OnWriteXml);
            comp.OnError += new ErrorHandler(comp_OnError);
            comp.OnXmppConnectionStateChanged += new agsXMPP.XmppClientConnection.XmppConnectionStateHandler(comp_OnXmppConnectionStateChanged);
            //comp.ClientSocket.OnValidateCertificate += new System.Net.Security.RemoteCertificateValidationCallback(ClientSocket_OnValidateCertificate);
            //comp.OnXmppConnectionStateChanged += new agsXMPP.XmppClientConnection.XmppConnectionStateHandler(comp_OnXmppConnectionStateChanged);


            comp.Open();

           
               Console.ReadLine();
            comp.Close();
           
            Console.ReadLine();
           
            Console.WriteLine("And open the Connection again");
            comp.Open();
            Console.ReadLine();

            comp.Close();
           
            Console.ReadLine();
           
        }

        private static void comp_OnClose(object sender)
        {
            Console.WriteLine("OnClose\r\n");
        }

        private static void comp_OnLogin(object sender)
        {
            Console.WriteLine("OnLogin\r\n");
        }

        private static void comp_OnRoute(object sender, agsXMPP.protocol.component.Route r)
        {

        }

        private static void comp_OnReadXml(object sender, string xml)
        {
            Console.WriteLine("OnReadXml: " + xml + "\r\n");
        }

        private static void comp_OnWriteXml(object sender, string xml)
        {
            Console.WriteLine("OnWriteXml: " + xml + "\r\n");
        }

        private static void comp_OnSaslStart(object sender, SaslEventArgs args)
        {
            // You can define the SASL mechanism here when needed, or implement your own SASL mechanisms
            // for authentication

            args.Auto = true;
            //args.Mechanism = agsXMPP.protocol.sasl.Mechanism.GetMechanismName(agsXMPP.protocol.sasl.MechanismType.GSSAPI);
        }  

        private bool ClientSocket_OnValidateCertificate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
       
        private static void comp_OnXmppConnectionStateChanged(object sender, XmppConnectionState state)
        {
            Console.WriteLine("OnXmppConnectionStateChanged: " + state.ToString());
        }

        private static void comp_OnError(object sender, Exception ex)
        {
            Console.WriteLine("On Error: " + ex.Message);
        }

Below is the output I get:

OnXmppConnectionStateChanged: Connecting
OnXmppConnectionStateChanged: Connected
OnWriteXml: <stream:stream to='30.0.12.12' xmlns='jabber:client' xmlns:stream='h
ttp://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

OnReadXml: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xml:la
ng="en" version="1.0" id="7670C162A" from="30.0.12.12" >

OnReadXml: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mec
hanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism kerb:principal="xmpp
/devjabber.voicelab.voice.ml.com@AMRSD.WINDEV.ML.COM">GSSAPI</mechanism><mechani
sm>PLAIN</mechanism></mechanisms></stream:features>

OnWriteXml: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">XXX</auth>

OnReadXml: <stream:error xmlns:stream="http://etherx.jabber.org/streams"><intern
al-server-error xmlns="urn:ietf:parms:xml:ns:xmpp-streams" /><text xmlns="urn:ie
tf:params:xml:ns:xmpp-streams" xml:lang="en">user not found</text></stream:error
>

OnReadXml: </stream:stream>

OnXmppConnectionStateChanged: Disconnected
OnClose

Any ideas, thoughts would be greatly appreciated.
This post was edited on 2012-12-14, 12:17 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi ugandhi,

in your code i have seen some IP adresses. The XMPP Domain which in your case is a IP adress is included in the SASL authentication. So make sure that your server is also configured with a IP address as XMPP domain.
But we always say never use IP addresses in XMPP.

Alex
Avatar
ugandhi #3
Member since May 2007 · 2 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #1
Alex,


I tried your suggestion still can not connect. Below is the revised code.

 // The Jid which this component will use
            //Jid jid = new Jid("ugandhi","devjabber.voicelab.voice.ml.com","test code");

            //Jid jid = new Jid("ugandhi", "imbots.apps.ml.com", "bots code");
              

            comp.Server = "devjabber.voicelab.voice.ml.com";
            comp.Username = "ugandhi";
            comp.Password = "upen01@";
            comp.Resource = "test code";
            comp.Priority = 1;
            comp.Port = 5224;
            comp.UseSSL = false;
            comp.AutoResolveConnectServer = true;
                      
            comp.UseStartTLS = false;


I think the issue is the following:

we use windows credentials to log into the Jabber server for single sign on purposes.  The jabber server takes our windows userid and maps to our emailid via Active Directory call.   i.e.  ugandhi(windows nt userid) --> upendra_gandhi@ml.com(Jabber JID).  This process authenticates the user and makes sure the password is also valid.   Also in our Jabber Client we are required to put in a windows domain.  ie. amrsd.windev.ml.com

Therefore when I am putting in userid and password via this code, there is no way to specify windows domain, which in return gives me an error user not found.

Any thoughts or suggestion to resolving this issue.

Upen (ugandhi)
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Upen,

are you sure that your server is setup correctly?
Which server software are you using?
Did you try to login with another existing jabber client (Exodus, Pandion, Psi ...)?

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS