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); }
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; }
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; }