code: def onHello(self, realm, details):
          
          log.msg("onHello: {} {}".format(realm, details))
  
          self._pending_auth = None
  
          if details.authmethods:
              for authmethod in details.authmethods:
                  if authmethod == u"wampcra":
  
                      ## lookup user in user DB
                      salt, key, role, uid = yield self.factory.userdb.get(details.authid)
                      log.msg("salt, key, role: {} {} {} {}".format(salt, key, role, uid))
  
                      ## if user found ..
                      if key:
  
                          log.msg("found key")
  
                          ## setup pending auth
                          self._pending_auth = PendingAuth(key, details.pending_session,
                              details.authid, role, authmethod, u"userdb", uid)
  
                          log.msg("setting challenge")
                          ## send challenge to client
                          extra = {
                              u'challenge': self._pending_auth.challenge
                          }
  
                          ## when using salted passwords, provide the client with
                          ## the salt and then PBKDF2 parameters used
                          if salt:
                              extra[u'salt'] = salt
                              extra[u'iterations'] = 1000
                              extra[u'keylen'] = 32
  
                          defer.returnValue(types.Challenge(u'wampcra', extra))
  
          ## deny client
          defer.returnValue(types.Deny())
docs: Callback fired when client wants to attach session.