Exemplo n.º 1
0
        public override Tag Initialize()
        {
#if DEBUG
            Manager.Events.LogMessage(this, LogType.Debug, "Initializing XOAUTH2 Processor");
            Manager.Events.LogMessage(this, LogType.Debug, "ID User: {0}", Manager.Settings.Id);
#endif

            string token = "";

            tags.xmpp_sasl.auth authtag = new tags.xmpp_sasl.auth();

            authtag.mechanism = MechanismType.XOAUTH2;

            XNamespace auth = "http://www.google.com/talk/protocol/auth";
            authtag.Add(new XAttribute(XNamespace.Xmlns + "auth", "http://www.google.com/talk/protocol/auth"));
            authtag.Add(new XAttribute(auth + "service", "oauth2"));

            var sb = new StringBuilder();

            sb.Append((char)0);
            sb.Append(Manager.Settings.Id);
            sb.Append((char)0);
            sb.Append(token);

            authtag.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString()));

            return(authtag as Tag);
        }
Exemplo n.º 2
0
		public override Tag Initialize()
		{
#if DEBUG
			Manager.Events.LogMessage(this, LogType.Debug, "Initializing XOAUTH2 Processor");
			Manager.Events.LogMessage(this, LogType.Debug, "ID User: {0}", Manager.Settings.Id);
#endif

            string token = "";

            tags.xmpp_sasl.auth authtag = new tags.xmpp_sasl.auth();

            authtag.mechanism = MechanismType.XOAUTH2;

            XNamespace auth = "http://www.google.com/talk/protocol/auth";
            authtag.Add(new XAttribute(XNamespace.Xmlns + "auth", "http://www.google.com/talk/protocol/auth"));
            authtag.Add(new XAttribute(auth + "service", "oauth2"));

            var sb = new StringBuilder();

            sb.Append((char)0);
            sb.Append(Manager.Settings.Id);
            sb.Append((char)0);
            sb.Append(token);

            authtag.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString()));
            
            return authtag as Tag;
		}