def auth(self,name,password,dup=None):
        """ Authenticate component "name" with password "password"."""
        self._User,self._Password,self._Resource=name,password,''
        try:
            if self.sasl: auth.SASL(name,password).PlugIn(self)
            if not self.sasl or self.SASL.startsasl=='not-supported':
                if auth.NonSASL(name,password,'').PlugIn(self):
                    self.dobind(sasl=False)
                    self.connected+='+old_auth'
                    return 'old_auth'
                return
            self.SASL.auth()
            while self.SASL.startsasl=='in-process' and self.Process(1): pass
            if self.SASL.startsasl=='success':
                self.dobind(sasl=True)
                self.connected+='+sasl'
                return 'sasl'
            else:
                raise auth.NotAuthorized(self.SASL.startsasl)
        except:
            self.DEBUG(self.DBG,"Failed to authenticate %s"%name,'error')
 Authenticate component "name" with password "password".
chrome-cordova/gcmServer/xmpp/client.py