示例#1
0
		public XmppServer()
		{
			StorageManager = new StorageManager();
			userManager = new UserManager(StorageManager);
			AuthManager = new AuthManager();

			streamManager = new XmppStreamManager();
			SessionManager = new XmppSessionManager();

			gateway = new XmppGateway();
			sender = new XmppSender(gateway);

			serviceManager = new XmppServiceManager(this);
			handlerManager = new XmppHandlerManager(streamManager, gateway, sender, this);
		}
示例#2
0
		private bool AuthPlain(string username, string password, XmppStream stream, UserManager userManager)
		{
			var user = userManager.GetUser(new Jid(username, stream.Domain, null));
			if (user != null)
			{
				return string.Compare(user.Password, password, StringComparison.Ordinal) == 0;
			}
			return false;
		}
示例#3
0
		private bool AuthDigest(string username, string hash, XmppStream stream, UserManager userManager)
		{
			var user = userManager.GetUser(new Jid(username, stream.Domain, null));
			if (user != null)
			{
				string serverhash = Hash.Sha1Hash(stream.Id + user.Password);
				return string.Compare(serverhash, hash, StringComparison.OrdinalIgnoreCase) == 0;
			}
			return false;
		}